mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-01 10:42:11 +00:00
[SCSI] enclosure: fix error path - actually return ERR_PTR() on error
we also need to clean up and free the cdev. Reported-by: Jani Nikula <ext-jani.1.nikula@nokia.com> Cc: Stable Tree <stable@kernel.org> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
This commit is contained in:
parent
aac3118d33
commit
a91c1be217
@ -285,8 +285,11 @@ enclosure_component_register(struct enclosure_device *edev,
|
||||
cdev->groups = enclosure_groups;
|
||||
|
||||
err = device_register(cdev);
|
||||
if (err)
|
||||
ERR_PTR(err);
|
||||
if (err) {
|
||||
ecomp->number = -1;
|
||||
put_device(cdev);
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
|
||||
return ecomp;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user