scsi: fcoe: Fix unsigned comparison with zero in store_ctlr_mode()
authorHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Tue, 2 Jan 2024 08:52:45 +0000 (00:52 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 12 Jan 2024 02:26:26 +0000 (21:26 -0500)
commit567a1e852e872e702b18d271a3dbce2a75efbaff
treeb2e77f323fcadf3bd0866b61cde10d0cb89a61fc
parent904fdd2062f3101fb09db8ee077abf7ffd95e538
scsi: fcoe: Fix unsigned comparison with zero in store_ctlr_mode()

ctlr->mode is of unsigned type, it is never less than zero.

Fix this by using an extra variable called 'res', to store return value
from sysfs_match_string() and assign that to ctlr->mode on the success
path.

Fixes: edc22a7c8688 ("scsi: fcoe: Use sysfs_match_string() over fcoe_parse_mode()")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Link: https://lore.kernel.org/r/20240102085245.600570-1-harshit.m.mogalapalli@oracle.com
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/fcoe/fcoe_sysfs.c