From owner-svn-src-all@FreeBSD.ORG Thu Apr 18 10:03:45 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E965737D; Thu, 18 Apr 2013 10:03:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CBC349BE; Thu, 18 Apr 2013 10:03:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3IA3jS4000501; Thu, 18 Apr 2013 10:03:45 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3IA3iP4000498; Thu, 18 Apr 2013 10:03:44 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201304181003.r3IA3iP4000498@svn.freebsd.org> From: Alexander Motin Date: Thu, 18 Apr 2013 10:03:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r249614 - in stable/9/sys/cam: ata scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Apr 2013 10:03:46 -0000 Author: mav Date: Thu Apr 18 10:03:44 2013 New Revision: 249614 URL: http://svnweb.freebsd.org/changeset/base/249614 Log: MFC r249105: Remove extra NULL checks. d_drv1 can never be NULL during periph life cycle. Modified: stable/9/sys/cam/ata/ata_da.c stable/9/sys/cam/scsi/scsi_cd.c stable/9/sys/cam/scsi/scsi_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_da.c ============================================================================== --- stable/9/sys/cam/ata/ata_da.c Thu Apr 18 10:01:43 2013 (r249613) +++ stable/9/sys/cam/ata/ata_da.c Thu Apr 18 10:03:44 2013 (r249614) @@ -528,10 +528,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); } @@ -567,9 +563,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); @@ -647,10 +640,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); @@ -698,8 +687,6 @@ adadump(void *arg, void *virtual, vm_off 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; @@ -1028,9 +1015,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); Modified: stable/9/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_cd.c Thu Apr 18 10:01:43 2013 (r249613) +++ stable/9/sys/cam/scsi/scsi_cd.c Thu Apr 18 10:03:44 2013 (r249614) @@ -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)); @@ -1971,9 +1959,6 @@ cdioctl(struct disk *dp, u_long cmd, voi 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: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Thu Apr 18 10:01:43 2013 (r249613) +++ stable/9/sys/cam/scsi/scsi_da.c Thu Apr 18 10:03:44 2013 (r249614) @@ -959,10 +959,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); } @@ -1024,9 +1020,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); @@ -1115,10 +1108,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); @@ -1166,8 +1155,6 @@ dadump(void *arg, void *virtual, vm_offs 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 @@ 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); @@ -1287,7 +1271,6 @@ dadiskgonecb(struct disk *dp) struct cam_periph *periph; periph = (struct cam_periph *)dp->d_drv1; - cam_periph_release(periph); }