Skip to contentSkip to conversation

sd: fix an error return in probe()

PATCH In review Dan Carpenter 2 participants 3 messages Jan 19, 2015 – Apr 16, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

drivers/scsi/sd.c +2 -1
index ebf35cb6..75a0b55 100644
@@ -3019,7 +3019,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);
#1 lore raw

I almost accidentally sent this one again. I still think it's correct.

regards,
dan carpenter

Quoted 23 lines · Dan Carpenter

If device_add() fails then it should return the error code but instead the current code returns success.

drivers/scsi/sd.c +2 -2
index ebf35cb6..75a0b55 100644
@@ -3019,7 +3019,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);
--

To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Reviewed-by on v1 1/1
#2 lore raw
In reply to Dan Carpenter
Quoted 20 lines · Dan Carpenter

If device_add() fails then it should return the error code but instead the current code returns success.

drivers/scsi/sd.c +2 -2
index ebf35cb6..75a0b55 100644
@@ -3019,7 +3019,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);
--
Quoted 3 lines

To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Tomas