From patchwork Fri Aug 25 20:46:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9922793 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BC44260349 for ; Fri, 25 Aug 2017 20:48:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADE7828450 for ; Fri, 25 Aug 2017 20:48:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2D1A284AA; Fri, 25 Aug 2017 20:48:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2EAB322638 for ; Fri, 25 Aug 2017 20:48:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932996AbdHYUsa (ORCPT ); Fri, 25 Aug 2017 16:48:30 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:40785 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932966AbdHYUs2 (ORCPT ); Fri, 25 Aug 2017 16:48:28 -0400 X-IronPort-AV: E=Sophos;i="5.41,426,1498492800"; d="scan'208";a="141842435" Received: from sjappemgw12.hgst.com (HELO sjappemgw11.hgst.com) ([199.255.44.66]) by ob1.hgst.iphmx.com with ESMTP; 26 Aug 2017 04:57:15 +0800 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.172.152]) by sjappemgw11.hgst.com with ESMTP; 25 Aug 2017 13:46:43 -0700 From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Bart Van Assche , Bart Van Assche Subject: [PATCH v2 07/17] sd, sr: Convert two assignments into warning statements Date: Fri, 25 Aug 2017 13:46:33 -0700 Message-Id: <20170825204643.25043-8-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170825204643.25043-1-bart.vanassche@wdc.com> References: <20170825204643.25043-1-bart.vanassche@wdc.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Before scsi_prep_fn() calls the ULP .init_command() callback function it stores the SCSI command pointer in request.special. This means that the SCpnt = rq->special assignments in the sd and sr drivers assign a pointer to itself. Hence convert these two assignment statements into warning statements. Signed-off-by: Bart Van Assche Reviewed-by: Hannes Reinecke Reviewed-by: Johannes Thumshirn Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 2 +- drivers/scsi/sr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index bea36adeee17..a88639fbedb3 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1013,7 +1013,7 @@ static int sd_setup_read_write_cmnd(struct scsi_cmnd *SCpnt) ret = scsi_init_io(SCpnt); if (ret != BLKPREP_OK) goto out; - SCpnt = rq->special; + WARN_ON_ONCE(SCpnt != rq->special); /* from here on until we're complete, any goto out * is used for a killable error condition */ diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index a8f630213a1a..9be34d37c356 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -393,7 +393,7 @@ static int sr_init_command(struct scsi_cmnd *SCpnt) ret = scsi_init_io(SCpnt); if (ret != BLKPREP_OK) goto out; - SCpnt = rq->special; + WARN_ON_ONCE(SCpnt != rq->special); cd = scsi_cd(rq->rq_disk); /* from here on until we're complete, any goto out