MFprojects/camlock r248930:

Remove extra NULL checks. d_drv1 can never be NULL during periph life cycle.

MFC after:	2 weeks
This commit is contained in:
Alexander Motin 2013-04-04 19:04:15 +00:00
parent de9ebb6812
commit f86141290c
3 changed files with 0 additions and 48 deletions

View File

@ -527,10 +527,6 @@ adaopen(struct disk *dp)
int error;
periph = (struct cam_periph *)dp->d_drv1;
if (periph == NULL) {
return (ENXIO);
}
if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
return(ENXIO);
}
@ -566,9 +562,6 @@ adaclose(struct disk *dp)
union ccb *ccb;
periph = (struct cam_periph *)dp->d_drv1;
if (periph == NULL)
return (ENXIO);
cam_periph_lock(periph);
if (cam_periph_hold(periph, PRIBIO) != 0) {
cam_periph_unlock(periph);
@ -646,10 +639,6 @@ adastrategy(struct bio *bp)
struct ada_softc *softc;
periph = (struct cam_periph *)bp->bio_disk->d_drv1;
if (periph == NULL) {
biofinish(bp, NULL, ENXIO);
return;
}
softc = (struct ada_softc *)periph->softc;
cam_periph_lock(periph);
@ -704,8 +693,6 @@ adadump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t len
dp = arg;
periph = dp->d_drv1;
if (periph == NULL)
return (ENXIO);
softc = (struct ada_softc *)periph->softc;
cam_periph_lock(periph);
secsize = softc->params.secsize;
@ -1038,9 +1025,6 @@ adagetattr(struct bio *bp)
struct cam_periph *periph;
periph = (struct cam_periph *)bp->bio_disk->d_drv1;
if (periph == NULL)
return (ENXIO);
cam_periph_lock(periph);
ret = xpt_getattr(bp->bio_data, bp->bio_length, bp->bio_attribute,
periph->path);

View File

@ -386,7 +386,6 @@ cddiskgonecb(struct disk *dp)
struct cam_periph *periph;
periph = (struct cam_periph *)dp->d_drv1;
cam_periph_release(periph);
}
@ -1073,9 +1072,6 @@ cdopen(struct disk *dp)
int error;
periph = (struct cam_periph *)dp->d_drv1;
if (periph == NULL)
return (ENXIO);
softc = (struct cd_softc *)periph->softc;
if (cam_periph_acquire(periph) != CAM_REQ_CMP)
@ -1120,9 +1116,6 @@ cdclose(struct disk *dp)
struct cd_softc *softc;
periph = (struct cam_periph *)dp->d_drv1;
if (periph == NULL)
return (ENXIO);
softc = (struct cd_softc *)periph->softc;
cam_periph_lock(periph);
@ -1473,11 +1466,6 @@ cdstrategy(struct bio *bp)
struct cd_softc *softc;
periph = (struct cam_periph *)bp->bio_disk->d_drv1;
if (periph == NULL) {
biofinish(bp, NULL, ENXIO);
return;
}
cam_periph_lock(periph);
CAM_DEBUG(periph->path, CAM_DEBUG_TRACE,
("cdstrategy(%p)\n", bp));
@ -1972,9 +1960,6 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int flag, struct thread *td)
int nocopyout, error = 0;
periph = (struct cam_periph *)dp->d_drv1;
if (periph == NULL)
return(ENXIO);
cam_periph_lock(periph);
softc = (struct cd_softc *)periph->softc;

View File

@ -962,10 +962,6 @@ daopen(struct disk *dp)
int error;
periph = (struct cam_periph *)dp->d_drv1;
if (periph == NULL) {
return (ENXIO);
}
if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
return (ENXIO);
}
@ -1027,9 +1023,6 @@ daclose(struct disk *dp)
struct da_softc *softc;
periph = (struct cam_periph *)dp->d_drv1;
if (periph == NULL)
return (0);
cam_periph_lock(periph);
if (cam_periph_hold(periph, PRIBIO) != 0) {
cam_periph_unlock(periph);
@ -1118,10 +1111,6 @@ dastrategy(struct bio *bp)
struct da_softc *softc;
periph = (struct cam_periph *)bp->bio_disk->d_drv1;
if (periph == NULL) {
biofinish(bp, NULL, ENXIO);
return;
}
softc = (struct da_softc *)periph->softc;
cam_periph_lock(periph);
@ -1174,8 +1163,6 @@ dadump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t leng
dp = arg;
periph = dp->d_drv1;
if (periph == NULL)
return (ENXIO);
softc = (struct da_softc *)periph->softc;
cam_periph_lock(periph);
secsize = softc->params.secsize;
@ -1250,9 +1237,6 @@ dagetattr(struct bio *bp)
struct cam_periph *periph;
periph = (struct cam_periph *)bp->bio_disk->d_drv1;
if (periph == NULL)
return (ENXIO);
cam_periph_lock(periph);
ret = xpt_getattr(bp->bio_data, bp->bio_length, bp->bio_attribute,
periph->path);
@ -1295,7 +1279,6 @@ dadiskgonecb(struct disk *dp)
struct cam_periph *periph;
periph = (struct cam_periph *)dp->d_drv1;
cam_periph_release(periph);
}