Commit d07e0361 authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by James Bottomley

[SCSI] sg: handle class_device_create failure properly

Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: default avatarDouglas Gilbert <dougg@torque.net>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent a24484f2
...@@ -1434,11 +1434,14 @@ sg_add(struct class_device *cl_dev, struct class_interface *cl_intf) ...@@ -1434,11 +1434,14 @@ sg_add(struct class_device *cl_dev, struct class_interface *cl_intf)
MKDEV(SCSI_GENERIC_MAJOR, sdp->index), MKDEV(SCSI_GENERIC_MAJOR, sdp->index),
cl_dev->dev, "%s", cl_dev->dev, "%s",
disk->disk_name); disk->disk_name);
if (IS_ERR(sg_class_member)) if (IS_ERR(sg_class_member)) {
printk(KERN_WARNING "sg_add: " printk(KERN_ERR "sg_add: "
"class_device_create failed\n"); "class_device_create failed\n");
error = PTR_ERR(sg_class_member);
goto cdev_add_err;
}
class_set_devdata(sg_class_member, sdp); 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"); &sg_class_member->kobj, "generic");
if (error) if (error)
printk(KERN_ERR "sg_add: unable to make symlink " printk(KERN_ERR "sg_add: unable to make symlink "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment