1
0
Fork 0

[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>
hifive-unleashed-5.1
James Bottomley 2010-03-12 16:14:42 -06:00
parent aac3118d33
commit a91c1be217
1 changed files with 5 additions and 2 deletions

View File

@ -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;
}