From dee0586e15d5d5796dd76bdc0ecfb7df7c5ee1c8 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 19 Jan 2015 17:41:12 +0300 Subject: [PATCH] sd: fix an error return in probe() If device_add() fails then it should return the error code but instead the current code returns success. Signed-off-by: Dan Carpenter Reviewed-by: Tomas Henzl Signed-off-by: James Bottomley --- drivers/scsi/sd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 7f9d65fe4fd9..3b2fcb4fada0 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2988,7 +2988,8 @@ static int sd_probe(struct device *dev) sdkp->dev.class = &sd_disk_class; dev_set_name(&sdkp->dev, "%s", dev_name(dev)); - if (device_add(&sdkp->dev)) + error = device_add(&sdkp->dev); + if (error) goto out_free_index; get_device(dev); -- 2.34.1