mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 13:53:33 +00:00
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 <dan.carpenter@linaro.org> Signed-off-by: Juergen Gross <jgross@suse.com> Link: https://lore.kernel.org/r/20230822064817.27257-1-jgross@suse.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
1451455e6f
commit
73c7881b50
1 changed files with 3 additions and 3 deletions
|
@ -743,7 +743,7 @@ static int scsifront_sdev_configure(struct scsi_device *sdev)
|
||||||
if (info->host_active == STATE_ERROR)
|
if (info->host_active == STATE_ERROR)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
if (info && current == info->curr) {
|
if (current == info->curr) {
|
||||||
err = xenbus_printf(XBT_NIL, info->dev->nodename,
|
err = xenbus_printf(XBT_NIL, info->dev->nodename,
|
||||||
info->dev_state_path, "%d", XenbusStateConnected);
|
info->dev_state_path, "%d", XenbusStateConnected);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -761,7 +761,7 @@ static void scsifront_sdev_destroy(struct scsi_device *sdev)
|
||||||
struct vscsifrnt_info *info = shost_priv(sdev->host);
|
struct vscsifrnt_info *info = shost_priv(sdev->host);
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (info && current == info->curr) {
|
if (current == info->curr) {
|
||||||
err = xenbus_printf(XBT_NIL, info->dev->nodename,
|
err = xenbus_printf(XBT_NIL, info->dev->nodename,
|
||||||
info->dev_state_path, "%d", XenbusStateClosed);
|
info->dev_state_path, "%d", XenbusStateClosed);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -903,7 +903,7 @@ static int scsifront_probe(struct xenbus_device *dev,
|
||||||
xenbus_dev_fatal(dev, err, "fail to allocate scsi host");
|
xenbus_dev_fatal(dev, err, "fail to allocate scsi host");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
info = (struct vscsifrnt_info *)host->hostdata;
|
info = shost_priv(host);
|
||||||
|
|
||||||
dev_set_drvdata(&dev->dev, info);
|
dev_set_drvdata(&dev->dev, info);
|
||||||
info->dev = dev;
|
info->dev = dev;
|
||||||
|
|
Loading…
Reference in a new issue