Skip to content

Commit 73c7881

Browse files
jgross1martinkpetersen
authored andcommitted
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 <[email protected]> Signed-off-by: Juergen Gross <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 1451455 commit 73c7881

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/scsi/xen-scsifront.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ static int scsifront_sdev_configure(struct scsi_device *sdev)
743743
if (info->host_active == STATE_ERROR)
744744
return -EIO;
745745

746-
if (info && current == info->curr) {
746+
if (current == info->curr) {
747747
err = xenbus_printf(XBT_NIL, info->dev->nodename,
748748
info->dev_state_path, "%d", XenbusStateConnected);
749749
if (err) {
@@ -761,7 +761,7 @@ static void scsifront_sdev_destroy(struct scsi_device *sdev)
761761
struct vscsifrnt_info *info = shost_priv(sdev->host);
762762
int err;
763763

764-
if (info && current == info->curr) {
764+
if (current == info->curr) {
765765
err = xenbus_printf(XBT_NIL, info->dev->nodename,
766766
info->dev_state_path, "%d", XenbusStateClosed);
767767
if (err)
@@ -903,7 +903,7 @@ static int scsifront_probe(struct xenbus_device *dev,
903903
xenbus_dev_fatal(dev, err, "fail to allocate scsi host");
904904
return err;
905905
}
906-
info = (struct vscsifrnt_info *)host->hostdata;
906+
info = shost_priv(host);
907907

908908
dev_set_drvdata(&dev->dev, info);
909909
info->dev = dev;

0 commit comments

Comments
 (0)