scsi: scsi_debug: Fix an error handling bug in sdeb_zbc_model_str()

This test is checking the wrong variable.  It should be testing "res".
The "sdeb_zbc_model" variable is an enum (unsigned in this situation)
and we never assign negative values to it.

[mkp: fixed commit desc issue reported by Doug]

Link: https://lore.kernel.org/r/20200509100408.GA5555@mwanda
Fixes: 9267e0eb41 ("scsi: scsi_debug: Add ZBC module parameter")
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Dan Carpenter 2020-05-09 13:04:08 +03:00 committed by Martin K. Petersen
parent d0dff2ac98
commit 47742bde28
1 changed files with 1 additions and 1 deletions

View File

@ -6460,7 +6460,7 @@ static int sdeb_zbc_model_str(const char *cp)
res = sysfs_match_string(zbc_model_strs_b, cp);
if (res < 0) {
res = sysfs_match_string(zbc_model_strs_c, cp);
if (sdeb_zbc_model < 0)
if (res < 0)
return -EINVAL;
}
}