svn commit: r241404 - in head/sys/cam: ata scsi

Alexander Motin mav at FreeBSD.org
Wed Oct 10 18:10:12 UTC 2012


Author: mav
Date: Wed Oct 10 18:10:11 2012
New Revision: 241404
URL: http://svn.freebsd.org/changeset/base/241404

Log:
  Remove 'periph == NULL' check from bunch of periph drivers.
  This condition can never be true as functions are called from single place
  and the checks just pollute the code and confuse Clang Static Analyzer.

Modified:
  head/sys/cam/ata/ata_da.c
  head/sys/cam/ata/ata_pmp.c
  head/sys/cam/ata/ata_xpt.c
  head/sys/cam/scsi/scsi_cd.c
  head/sys/cam/scsi/scsi_ch.c
  head/sys/cam/scsi/scsi_da.c
  head/sys/cam/scsi/scsi_pass.c
  head/sys/cam/scsi/scsi_sa.c
  head/sys/cam/scsi/scsi_sg.c
  head/sys/cam/scsi/scsi_xpt.c

Modified: head/sys/cam/ata/ata_da.c
==============================================================================
--- head/sys/cam/ata/ata_da.c	Wed Oct 10 18:01:56 2012	(r241403)
+++ head/sys/cam/ata/ata_da.c	Wed Oct 10 18:10:11 2012	(r241404)
@@ -943,11 +943,6 @@ adaregister(struct cam_periph *periph, v
 	int legacy_id, quirks;
 
 	cgd = (struct ccb_getdev *)arg;
-	if (periph == NULL) {
-		printf("adaregister: periph was NULL!!\n");
-		return(CAM_REQ_CMP_ERR);
-	}
-
 	if (cgd == NULL) {
 		printf("adaregister: no getdev CCB, can't register device\n");
 		return(CAM_REQ_CMP_ERR);

Modified: head/sys/cam/ata/ata_pmp.c
==============================================================================
--- head/sys/cam/ata/ata_pmp.c	Wed Oct 10 18:01:56 2012	(r241403)
+++ head/sys/cam/ata/ata_pmp.c	Wed Oct 10 18:10:11 2012	(r241404)
@@ -367,11 +367,6 @@ pmpregister(struct cam_periph *periph, v
 	struct ccb_getdev *cgd;
 
 	cgd = (struct ccb_getdev *)arg;
-	if (periph == NULL) {
-		printf("pmpregister: periph was NULL!!\n");
-		return(CAM_REQ_CMP_ERR);
-	}
-
 	if (cgd == NULL) {
 		printf("pmpregister: no getdev CCB, can't register device\n");
 		return(CAM_REQ_CMP_ERR);

Modified: head/sys/cam/ata/ata_xpt.c
==============================================================================
--- head/sys/cam/ata/ata_xpt.c	Wed Oct 10 18:01:56 2012	(r241403)
+++ head/sys/cam/ata/ata_xpt.c	Wed Oct 10 18:10:11 2012	(r241404)
@@ -224,11 +224,6 @@ proberegister(struct cam_periph *periph,
 	probe_softc *softc;
 
 	request_ccb = (union ccb *)arg;
-	if (periph == NULL) {
-		printf("proberegister: periph was NULL!!\n");
-		return(CAM_REQ_CMP_ERR);
-	}
-
 	if (request_ccb == NULL) {
 		printf("proberegister: no probe CCB, "
 		       "can't register device\n");

Modified: head/sys/cam/scsi/scsi_cd.c
==============================================================================
--- head/sys/cam/scsi/scsi_cd.c	Wed Oct 10 18:01:56 2012	(r241403)
+++ head/sys/cam/scsi/scsi_cd.c	Wed Oct 10 18:10:11 2012	(r241404)
@@ -692,10 +692,6 @@ cdregister(struct cam_periph *periph, vo
 	caddr_t match;
 
 	cgd = (struct ccb_getdev *)arg;
-	if (periph == NULL) {
-		printf("cdregister: periph was NULL!!\n");
-		return(CAM_REQ_CMP_ERR);
-	}
 	if (cgd == NULL) {
 		printf("cdregister: no getdev CCB, can't register device\n");
 		return(CAM_REQ_CMP_ERR);

Modified: head/sys/cam/scsi/scsi_ch.c
==============================================================================
--- head/sys/cam/scsi/scsi_ch.c	Wed Oct 10 18:01:56 2012	(r241403)
+++ head/sys/cam/scsi/scsi_ch.c	Wed Oct 10 18:10:11 2012	(r241404)
@@ -324,11 +324,6 @@ chregister(struct cam_periph *periph, vo
 	struct ccb_pathinq cpi;
 
 	cgd = (struct ccb_getdev *)arg;
-	if (periph == NULL) {
-		printf("chregister: periph was NULL!!\n");
-		return(CAM_REQ_CMP_ERR);
-	}
-
 	if (cgd == NULL) {
 		printf("chregister: no getdev CCB, can't register device\n");
 		return(CAM_REQ_CMP_ERR);

Modified: head/sys/cam/scsi/scsi_da.c
==============================================================================
--- head/sys/cam/scsi/scsi_da.c	Wed Oct 10 18:01:56 2012	(r241403)
+++ head/sys/cam/scsi/scsi_da.c	Wed Oct 10 18:10:11 2012	(r241404)
@@ -1583,11 +1583,6 @@ daregister(struct cam_periph *periph, vo
 	caddr_t match;
 
 	cgd = (struct ccb_getdev *)arg;
-	if (periph == NULL) {
-		printf("daregister: periph was NULL!!\n");
-		return(CAM_REQ_CMP_ERR);
-	}
-
 	if (cgd == NULL) {
 		printf("daregister: no getdev CCB, can't register device\n");
 		return(CAM_REQ_CMP_ERR);

Modified: head/sys/cam/scsi/scsi_pass.c
==============================================================================
--- head/sys/cam/scsi/scsi_pass.c	Wed Oct 10 18:01:56 2012	(r241403)
+++ head/sys/cam/scsi/scsi_pass.c	Wed Oct 10 18:10:11 2012	(r241404)
@@ -312,11 +312,6 @@ passregister(struct cam_periph *periph, 
 	int    no_tags;
 
 	cgd = (struct ccb_getdev *)arg;
-	if (periph == NULL) {
-		printf("%s: periph was NULL!!\n", __func__);
-		return(CAM_REQ_CMP_ERR);
-	}
-
 	if (cgd == NULL) {
 		printf("%s: no getdev CCB, can't register device\n", __func__);
 		return(CAM_REQ_CMP_ERR);

Modified: head/sys/cam/scsi/scsi_sa.c
==============================================================================
--- head/sys/cam/scsi/scsi_sa.c	Wed Oct 10 18:01:56 2012	(r241403)
+++ head/sys/cam/scsi/scsi_sa.c	Wed Oct 10 18:10:11 2012	(r241404)
@@ -1445,11 +1445,6 @@ saregister(struct cam_periph *periph, vo
 	int i;
 	
 	cgd = (struct ccb_getdev *)arg;
-	if (periph == NULL) {
-		printf("saregister: periph was NULL!!\n");
-		return (CAM_REQ_CMP_ERR);
-	}
-
 	if (cgd == NULL) {
 		printf("saregister: no getdev CCB, can't register device\n");
 		return (CAM_REQ_CMP_ERR);

Modified: head/sys/cam/scsi/scsi_sg.c
==============================================================================
--- head/sys/cam/scsi/scsi_sg.c	Wed Oct 10 18:01:56 2012	(r241403)
+++ head/sys/cam/scsi/scsi_sg.c	Wed Oct 10 18:10:11 2012	(r241404)
@@ -261,11 +261,6 @@ sgregister(struct cam_periph *periph, vo
 	int no_tags;
 
 	cgd = (struct ccb_getdev *)arg;
-	if (periph == NULL) {
-		printf("sgregister: periph was NULL!!\n");
-		return (CAM_REQ_CMP_ERR);
-	}
-
 	if (cgd == NULL) {
 		printf("sgregister: no getdev CCB, can't register device\n");
 		return (CAM_REQ_CMP_ERR);

Modified: head/sys/cam/scsi/scsi_xpt.c
==============================================================================
--- head/sys/cam/scsi/scsi_xpt.c	Wed Oct 10 18:01:56 2012	(r241403)
+++ head/sys/cam/scsi/scsi_xpt.c	Wed Oct 10 18:10:11 2012	(r241404)
@@ -615,11 +615,6 @@ proberegister(struct cam_periph *periph,
 	probe_softc *softc;
 
 	request_ccb = (union ccb *)arg;
-	if (periph == NULL) {
-		printf("proberegister: periph was NULL!!\n");
-		return(CAM_REQ_CMP_ERR);
-	}
-
 	if (request_ccb == NULL) {
 		printf("proberegister: no probe CCB, "
 		       "can't register device\n");


More information about the svn-src-head mailing list