SCSI fixes on 20230415
One small fix to SCSI Enclosure Services to fix a regression caused by another recent fix. Signed-off-by: James E.J. Bottomley <jejb@linux.ibm.com> -----BEGIN PGP SIGNATURE----- iJwEABMIAEQWIQTnYEDbdso9F2cI+arnQslM7pishQUCZDqyfiYcamFtZXMuYm90 dG9tbGV5QGhhbnNlbnBhcnRuZXJzaGlwLmNvbQAKCRDnQslM7pishZAiAQCtjwkq 7ZGxoyEI6LCHLx60UXhlwFRyDZ2gooSkjTt34gEA5timHhFNnF4/dgQbRn7EfYRs lUlUK+4t6zJ23VtjYhg= =Ze4S -----END PGP SIGNATURE----- Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi Pull SCSI fix from James Bottomley: "One small fix to SCSI Enclosure Services to fix a regression caused by another recent fix" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: ses: Handle enclosure with just a primary component gracefully
This commit is contained in:
commit
9772f14f55
|
@ -509,9 +509,6 @@ static int ses_enclosure_find_by_addr(struct enclosure_device *edev,
|
|||
int i;
|
||||
struct ses_component *scomp;
|
||||
|
||||
if (!edev->component[0].scratch)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < edev->components; i++) {
|
||||
scomp = edev->component[i].scratch;
|
||||
if (scomp->addr != efd->addr)
|
||||
|
@ -602,8 +599,10 @@ static void ses_enclosure_data_process(struct enclosure_device *edev,
|
|||
components++,
|
||||
type_ptr[0],
|
||||
name);
|
||||
else
|
||||
else if (components < edev->components)
|
||||
ecomp = &edev->component[components++];
|
||||
else
|
||||
ecomp = ERR_PTR(-EINVAL);
|
||||
|
||||
if (!IS_ERR(ecomp)) {
|
||||
if (addl_desc_ptr) {
|
||||
|
@ -734,11 +733,6 @@ static int ses_intf_add(struct device *cdev,
|
|||
components += type_ptr[1];
|
||||
}
|
||||
|
||||
if (components == 0) {
|
||||
sdev_printk(KERN_WARNING, sdev, "enclosure has no enumerated components\n");
|
||||
goto err_free;
|
||||
}
|
||||
|
||||
ses_dev->page1 = buf;
|
||||
ses_dev->page1_len = len;
|
||||
buf = NULL;
|
||||
|
@ -780,9 +774,11 @@ static int ses_intf_add(struct device *cdev,
|
|||
buf = NULL;
|
||||
}
|
||||
page2_not_supported:
|
||||
if (components > 0) {
|
||||
scomp = kcalloc(components, sizeof(struct ses_component), GFP_KERNEL);
|
||||
if (!scomp)
|
||||
goto err_free;
|
||||
}
|
||||
|
||||
edev = enclosure_register(cdev->parent, dev_name(&sdev->sdev_gendev),
|
||||
components, &ses_enclosure_callbacks);
|
||||
|
|
Loading…
Reference in New Issue