From: FUJITA Tomonori Date: Tue, 15 Jan 2008 04:18:00 +0000 (+0900) Subject: [SCSI] sg: handle class_device_create failure properly X-Git-Tag: v2.6.25-rc1~1230^2~34 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=d07e03610ca1f4be373f32ad5b25ac00dbdb867d;p=linux-2.6-omap-h63xx.git [SCSI] sg: handle class_device_create failure properly Signed-off-by: FUJITA Tomonori Acked-by: Douglas Gilbert Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index ebbf9b4b7e9..78ac48df4de 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -1434,11 +1434,14 @@ sg_add(struct class_device *cl_dev, struct class_interface *cl_intf) MKDEV(SCSI_GENERIC_MAJOR, sdp->index), cl_dev->dev, "%s", disk->disk_name); - if (IS_ERR(sg_class_member)) - printk(KERN_WARNING "sg_add: " - "class_device_create failed\n"); + if (IS_ERR(sg_class_member)) { + printk(KERN_ERR "sg_add: " + "class_device_create failed\n"); + error = PTR_ERR(sg_class_member); + goto cdev_add_err; + } class_set_devdata(sg_class_member, sdp); - error = sysfs_create_link(&scsidp->sdev_gendev.kobj, + error = sysfs_create_link(&scsidp->sdev_gendev.kobj, &sg_class_member->kobj, "generic"); if (error) printk(KERN_ERR "sg_add: unable to make symlink "