[Midnightbsd-cvs] src [9126] trunk/sys/cam: remove null checks that are impossible.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Oct 1 20:38:35 EDT 2016


Revision: 9126
          http://svnweb.midnightbsd.org/src/?rev=9126
Author:   laffer1
Date:     2016-10-01 20:38:35 -0400 (Sat, 01 Oct 2016)
Log Message:
-----------
remove null checks that are impossible.

Modified Paths:
--------------
    trunk/sys/cam/ata/ata_da.c
    trunk/sys/cam/scsi/scsi_cd.c
    trunk/sys/cam/scsi/scsi_da.c

Modified: trunk/sys/cam/ata/ata_da.c
===================================================================
--- trunk/sys/cam/ata/ata_da.c	2016-10-02 00:38:16 UTC (rev 9125)
+++ trunk/sys/cam/ata/ata_da.c	2016-10-02 00:38:35 UTC (rev 9126)
@@ -674,10 +674,6 @@
 	int error;
 
 	periph = (struct cam_periph *)dp->d_drv1;
-	if (periph == NULL) {
-		return (ENXIO);	
-	}
-
 	if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
 		return(ENXIO);
 	}
@@ -713,9 +709,6 @@
 	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);
@@ -793,10 +786,6 @@
 	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);
@@ -844,8 +833,6 @@
 
 	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;
@@ -1174,9 +1161,6 @@
 	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);

Modified: trunk/sys/cam/scsi/scsi_cd.c
===================================================================
--- trunk/sys/cam/scsi/scsi_cd.c	2016-10-02 00:38:16 UTC (rev 9125)
+++ trunk/sys/cam/scsi/scsi_cd.c	2016-10-02 00:38:35 UTC (rev 9126)
@@ -386,7 +386,6 @@
 	struct cam_periph *periph;
 
 	periph = (struct cam_periph *)dp->d_drv1;
-
 	cam_periph_release(periph);
 }
 
@@ -1073,9 +1072,6 @@
 	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 @@
 	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 @@
 	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));
@@ -1971,9 +1959,6 @@
 	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;

Modified: trunk/sys/cam/scsi/scsi_da.c
===================================================================
--- trunk/sys/cam/scsi/scsi_da.c	2016-10-02 00:38:16 UTC (rev 9125)
+++ trunk/sys/cam/scsi/scsi_da.c	2016-10-02 00:38:35 UTC (rev 9126)
@@ -959,10 +959,6 @@
 	int error;
 
 	periph = (struct cam_periph *)dp->d_drv1;
-	if (periph == NULL) {
-		return (ENXIO);	
-	}
-
 	if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
 		return (ENXIO);
 	}
@@ -1024,9 +1020,6 @@
 	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);
@@ -1115,10 +1108,6 @@
 	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);
@@ -1166,8 +1155,6 @@
 
 	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;
@@ -1242,9 +1229,6 @@
 	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);
@@ -1287,7 +1271,6 @@
 	struct cam_periph *periph;
 
 	periph = (struct cam_periph *)dp->d_drv1;
-
 	cam_periph_release(periph);
 }
 



More information about the Midnightbsd-cvs mailing list