diff options
author | Martin Wilck <mwilck@suse.com> | 2020-10-29 18:08:46 +0100 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2020-11-16 22:29:49 -0500 |
commit | 16d6317ea438b10c5747f5d4a972ea0e68d1a6ae (patch) | |
tree | faa6a4c0d9672d75846b5aaa756aed45bc92e543 /drivers/scsi/scsi_lib.c | |
parent | 2e4209b3806cda9b89c30fd5e7bfecb7044ec78b (diff) | |
download | lwn-16d6317ea438b10c5747f5d4a972ea0e68d1a6ae.tar.gz lwn-16d6317ea438b10c5747f5d4a972ea0e68d1a6ae.zip |
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>
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r-- | drivers/scsi/scsi_lib.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 5f963df0906a..b7ac14571415 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -3065,12 +3065,13 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len) } memset(id, 0, id_len); - d = vpd_pg83->data + 4; - while (d < vpd_pg83->data + vpd_pg83->len) { + for (d = vpd_pg83->data + 4; + d < vpd_pg83->data + vpd_pg83->len; + d += d[3] + 4) { u8 prio = designator_prio(d); if (prio == 0 || cur_id_prio > prio) - goto next_desig; + continue; switch (d[1] & 0xf) { case 0x1: @@ -3150,8 +3151,6 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len) default: break; } -next_desig: - d += d[3] + 4; } rcu_read_unlock(); |