mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2025-04-19 20:58:31 +09:00
scsi: core: Use a switch statement when attaching VPD pages
The original code used if statements to update discovered VPD pages when found. This had the side-effect of not breaking the loop when a page was found. Use an idiomatic switch statement instead. Signed-off-by: Chaohai Chen <wdhh6@aliyun.com> Link: https://lore.kernel.org/r/20250226065802.234144-1-wdhh6@aliyun.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
ffd6c17928
commit
e402ee093f
@ -510,22 +510,34 @@ void scsi_attach_vpd(struct scsi_device *sdev)
|
||||
return;
|
||||
|
||||
for (i = 4; i < vpd_buf->len; i++) {
|
||||
if (vpd_buf->data[i] == 0x0)
|
||||
switch (vpd_buf->data[i]) {
|
||||
case 0x0:
|
||||
scsi_update_vpd_page(sdev, 0x0, &sdev->vpd_pg0);
|
||||
if (vpd_buf->data[i] == 0x80)
|
||||
break;
|
||||
case 0x80:
|
||||
scsi_update_vpd_page(sdev, 0x80, &sdev->vpd_pg80);
|
||||
if (vpd_buf->data[i] == 0x83)
|
||||
break;
|
||||
case 0x83:
|
||||
scsi_update_vpd_page(sdev, 0x83, &sdev->vpd_pg83);
|
||||
if (vpd_buf->data[i] == 0x89)
|
||||
break;
|
||||
case 0x89:
|
||||
scsi_update_vpd_page(sdev, 0x89, &sdev->vpd_pg89);
|
||||
if (vpd_buf->data[i] == 0xb0)
|
||||
break;
|
||||
case 0xb0:
|
||||
scsi_update_vpd_page(sdev, 0xb0, &sdev->vpd_pgb0);
|
||||
if (vpd_buf->data[i] == 0xb1)
|
||||
break;
|
||||
case 0xb1:
|
||||
scsi_update_vpd_page(sdev, 0xb1, &sdev->vpd_pgb1);
|
||||
if (vpd_buf->data[i] == 0xb2)
|
||||
break;
|
||||
case 0xb2:
|
||||
scsi_update_vpd_page(sdev, 0xb2, &sdev->vpd_pgb2);
|
||||
if (vpd_buf->data[i] == 0xb7)
|
||||
break;
|
||||
case 0xb7:
|
||||
scsi_update_vpd_page(sdev, 0xb7, &sdev->vpd_pgb7);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
kfree(vpd_buf);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user