Commit a91c1be2 authored by James Bottomley's avatar James Bottomley

[SCSI] enclosure: fix error path - actually return ERR_PTR() on error

we also need to clean up and free the cdev.
Reported-by: default avatarJani Nikula <ext-jani.1.nikula@nokia.com>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent aac3118d
...@@ -285,8 +285,11 @@ enclosure_component_register(struct enclosure_device *edev, ...@@ -285,8 +285,11 @@ enclosure_component_register(struct enclosure_device *edev,
cdev->groups = enclosure_groups; cdev->groups = enclosure_groups;
err = device_register(cdev); err = device_register(cdev);
if (err) if (err) {
ERR_PTR(err); ecomp->number = -1;
put_device(cdev);
return ERR_PTR(err);
}
return ecomp; return ecomp;
} }
......
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