Skip to content

Commit 26b971d

Browse files
mrigendrachaubeymartinkpetersen
authored andcommitted
scsi: scsi_devinfo: Remove redundant 'found'
Remove the unnecessary 'found' flag in scsi_devinfo_lookup_by_key(). The loop can return the matching entry directly when found, and fall through to return ERR_PTR(-EINVAL) otherwise. Signed-off-by: mrigendrachaubey <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 6243146 commit 26b971d

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

drivers/scsi/scsi_devinfo.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -269,17 +269,12 @@ static struct {
269269
static struct scsi_dev_info_list_table *scsi_devinfo_lookup_by_key(int key)
270270
{
271271
struct scsi_dev_info_list_table *devinfo_table;
272-
int found = 0;
273272

274273
list_for_each_entry(devinfo_table, &scsi_dev_info_list, node)
275-
if (devinfo_table->key == key) {
276-
found = 1;
277-
break;
278-
}
279-
if (!found)
280-
return ERR_PTR(-EINVAL);
274+
if (devinfo_table->key == key)
275+
return devinfo_table;
281276

282-
return devinfo_table;
277+
return ERR_PTR(-EINVAL);
283278
}
284279

285280
/*

0 commit comments

Comments
 (0)