mirror of
https://github.com/torvalds/linux.git
synced 2025-11-03 10:10:33 +02:00
scsi: core: Replace while-loop by for-loop in scsi_vpd_lun_id()
This makes the code slightly more readable. Link: https://lore.kernel.org/r/20201029170846.14786-2-mwilck@suse.com Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin Wilck <mwilck@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
2e4209b380
commit
16d6317ea4
1 changed files with 4 additions and 5 deletions
|
|
@ -3065,12 +3065,13 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len)
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(id, 0, id_len);
|
memset(id, 0, id_len);
|
||||||
d = vpd_pg83->data + 4;
|
for (d = vpd_pg83->data + 4;
|
||||||
while (d < vpd_pg83->data + vpd_pg83->len) {
|
d < vpd_pg83->data + vpd_pg83->len;
|
||||||
|
d += d[3] + 4) {
|
||||||
u8 prio = designator_prio(d);
|
u8 prio = designator_prio(d);
|
||||||
|
|
||||||
if (prio == 0 || cur_id_prio > prio)
|
if (prio == 0 || cur_id_prio > prio)
|
||||||
goto next_desig;
|
continue;
|
||||||
|
|
||||||
switch (d[1] & 0xf) {
|
switch (d[1] & 0xf) {
|
||||||
case 0x1:
|
case 0x1:
|
||||||
|
|
@ -3150,8 +3151,6 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
next_desig:
|
|
||||||
d += d[3] + 4;
|
|
||||||
}
|
}
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue