From: Juergen Gross Date: Tue, 22 Aug 2023 06:48:17 +0000 (+0200) Subject: scsi: xen-scsifront: shost_priv() can never return NULL X-Git-Tag: v6.6.7~1928^2~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=73c7881b50667f4f8322c6e1bb51624f0f4085a8;p=platform%2Fkernel%2Flinux-starfive.git scsi: xen-scsifront: shost_priv() can never return NULL There is no need to check whether shost_priv() returns a non-NULL value, as the pointer returned is just an offset to the passed in parameter. While at it replace an open coded shost_priv() instance. Reported-by: Dan Carpenter Signed-off-by: Juergen Gross Link: https://lore.kernel.org/r/20230822064817.27257-1-jgross@suse.com Signed-off-by: Martin K. Petersen --- diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c index caae61a..9ec55dd 100644 --- a/drivers/scsi/xen-scsifront.c +++ b/drivers/scsi/xen-scsifront.c @@ -743,7 +743,7 @@ static int scsifront_sdev_configure(struct scsi_device *sdev) if (info->host_active == STATE_ERROR) return -EIO; - if (info && current == info->curr) { + if (current == info->curr) { err = xenbus_printf(XBT_NIL, info->dev->nodename, info->dev_state_path, "%d", XenbusStateConnected); if (err) { @@ -761,7 +761,7 @@ static void scsifront_sdev_destroy(struct scsi_device *sdev) struct vscsifrnt_info *info = shost_priv(sdev->host); int err; - if (info && current == info->curr) { + if (current == info->curr) { err = xenbus_printf(XBT_NIL, info->dev->nodename, info->dev_state_path, "%d", XenbusStateClosed); if (err) @@ -903,7 +903,7 @@ static int scsifront_probe(struct xenbus_device *dev, xenbus_dev_fatal(dev, err, "fail to allocate scsi host"); return err; } - info = (struct vscsifrnt_info *)host->hostdata; + info = shost_priv(host); dev_set_drvdata(&dev->dev, info); info->dev = dev;