On Tue, 2017-12-12 at 09:57 +0100, Hannes Reinecke wrote: > diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c > index ab75ebd..228b0b62 100644 > --- a/drivers/scsi/sd.c > +++ b/drivers/scsi/sd.c > @@ -3399,6 +3399,10 @@ static int sd_probe(struct device *dev) > } > > device_initialize(&sdkp->dev); > + > + if (!get_device(dev)) > + goto out_free_index; get_device(dev) returns the value of the 'dev' argument. Are you sure the if-test is useful? Did you perhaps want to check sdp->sdev_state like scsi_device_get() does? > sdkp->dev.parent = dev; > sdkp->dev.class = &sd_disk_class; > dev_set_name(&sdkp->dev, "%s", dev_name(dev)); > @@ -3407,7 +3411,6 @@ static int sd_probe(struct device *dev) > if (error) > goto out_free_index; > > - get_device(dev); > dev_set_drvdata(dev, sdkp); > > get_device(&sdkp->dev); /* prevent release before async_schedule */ Since the get_device() call has been moved up, are there any error paths that have to be adjusted? Bart.