Skip to content

Commit bf6971a

Browse files
nathanchancemartinkpetersen
authored andcommitted
scsi: dc395x: Remove leftover if statement in reselect()
Clang warns (or errors with CONFIG_WERROR=y): drivers/scsi/dc395x.c:2553:6: error: variable 'id' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] 2553 | if (!(rsel_tar_lun_id & (IDENTIFY_BASE << 8))) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/scsi/dc395x.c:2556:22: note: uninitialized use occurs here 2556 | dcb = find_dcb(acb, id, lun); | ^~ drivers/scsi/dc395x.c:2553:2: note: remove the 'if' if its condition is always true 2553 | if (!(rsel_tar_lun_id & (IDENTIFY_BASE << 8))) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2554 | id = rsel_tar_lun_id & 0xff; This if statement only existed for a debugging print but it was not removed with the debugging print in a recent cleanup, leading to id only being initialized when the if condition is true. Remove the if statement to ensure id is always initialized, clearing up the warning. Fixes: 62b434b ("scsi: dc395x: Remove DEBUG conditional compilation") Signed-off-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/r/20250429-scsi-dc395x-fix-uninit-var-v1-1-25215d481020@kernel.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent e142de4 commit bf6971a

1 file changed

Lines changed: 0 additions & 1 deletion

File tree

drivers/scsi/dc395x.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2550,7 +2550,6 @@ static void reselect(struct AdapterCtlBlk *acb)
25502550
}
25512551
}
25522552
/* Read Reselected Target Id and LUN */
2553-
if (!(rsel_tar_lun_id & (IDENTIFY_BASE << 8)))
25542553
id = rsel_tar_lun_id & 0xff;
25552554
lun = (rsel_tar_lun_id >> 8) & 7;
25562555
dcb = find_dcb(acb, id, lun);

0 commit comments

Comments
 (0)