mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Garry <john.g.garry@oracle.com>
To: jejb@linux.ibm.com, martin.petersen@oracle.com
Cc: linux-scsi@vger.kernel.org, bvanassche@acm.org,
	linux-kernel@vger.kernel.org, dgilbert@interlog.com,
	John Garry <john.g.garry@oracle.com>
Subject: [PATCH v2 04/11] scsi: scsi_debug: Drop scsi_debug_device_reset() NULL pointer checks
Date: Mon, 13 Mar 2023 08:44:59 +0000	[thread overview]
Message-ID: <20230313084505.1487337-5-john.g.garry@oracle.com> (raw)
In-Reply-To: <20230313084505.1487337-1-john.g.garry@oracle.com>

The SCSI cmnd pointer arg would never be NULL, so drop the check. In
addition, its SCSI device pointer would never be NULL (so drop that check
also).

The only caller is scsi_try_bus_device_reset(), and the command and its
device pointer could not be NULL when calling eh_device_reset_handler()
there.

Signed-off-by: John Garry <john.g.garry@oracle.com>
---
 drivers/scsi/scsi_debug.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 2c2a41b99641..5b51c24f7d09 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -5372,17 +5372,16 @@ static int scsi_debug_abort(struct scsi_cmnd *SCpnt)
 
 static int scsi_debug_device_reset(struct scsi_cmnd *SCpnt)
 {
+	struct scsi_device *sdp = SCpnt->device;
+	struct sdebug_dev_info *devip = sdp->hostdata;
+
 	++num_dev_resets;
-	if (SCpnt && SCpnt->device) {
-		struct scsi_device *sdp = SCpnt->device;
-		struct sdebug_dev_info *devip =
-				(struct sdebug_dev_info *)sdp->hostdata;
 
-		if (SDEBUG_OPT_ALL_NOISE & sdebug_opts)
-			sdev_printk(KERN_INFO, sdp, "%s\n", __func__);
-		if (devip)
-			set_bit(SDEBUG_UA_POR, devip->uas_bm);
-	}
+	if (SDEBUG_OPT_ALL_NOISE & sdebug_opts)
+		sdev_printk(KERN_INFO, sdp, "%s\n", __func__);
+	if (devip)
+		set_bit(SDEBUG_UA_POR, devip->uas_bm);
+
 	return SUCCESS;
 }
 
-- 
2.35.3


  parent reply	other threads:[~2023-03-13  8:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-13  8:44 [PATCH v2 00/11] scsi_debug: Some minor improvements John Garry
2023-03-13  8:44 ` [PATCH v2 01/11] scsi: scsi_debug: Don't hold driver host struct pointer in host->hostdata[] John Garry
2023-03-13  8:44 ` [PATCH v2 02/11] scsi: scsi_debug: Stop setting devip->sdbg_host twice John Garry
2023-03-13  8:44 ` [PATCH v2 03/11] scsi: scsi_debug: Drop scsi_debug_abort() NULL pointer checks John Garry
2023-03-13  8:44 ` John Garry [this message]
2023-03-13  8:45 ` [PATCH v2 05/11] scsi: scsi_debug: Drop scsi_debug_target_reset() " John Garry
2023-03-13  8:45 ` [PATCH v2 06/11] scsi: scsi_debug: Drop scsi_debug_bus_reset() " John Garry
2023-03-13  8:45 ` [PATCH v2 07/11] scsi: scsi_debug: Drop scsi_debug_host_reset() device NULL pointer check John Garry
2023-03-13  8:45 ` [PATCH v2 08/11] scsi: scsi_debug: Drop check for num_in_q exceeding queue depth John Garry
2023-03-13  8:45 ` [PATCH v2 10/11] scsi: scsi_debug: Get command abort feature working again John Garry
2023-03-13  8:45 ` [PATCH v2 11/11] scsi: scsi_debug: Add poll mode deferred completions to statistics John Garry
2023-03-13  9:25 ` [PATCH v2 00/11] scsi_debug: Some minor improvements John Garry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230313084505.1487337-5-john.g.garry@oracle.com \
    --to=john.g.garry@oracle.com \
    --cc=bvanassche@acm.org \
    --cc=dgilbert@interlog.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®