]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
scsi: pm8001: Fix error code in non_fatal_log_show()
authorDan Carpenter <error27@gmail.com>
Sat, 30 May 2026 19:45:48 +0000 (22:45 +0300)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 2 Jun 2026 01:52:12 +0000 (21:52 -0400)
The non_fatal_log_show() function is supposed to return negative error
codes on failure.  But because the error codes are saved in a u32 and
then cast to signed long, they end up being high positive values instead
of negative.  Remove the intermediary u32 variable to fix this bug.

Fixes: dba2cc03b9db ("scsi: pm80xx: sysfs attribute for non fatal dump")
Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Jack Wang <jinpu.wang@ionos.com>
Link: https://patch.msgid.link/ahs-bEsBJH0KhnsX@stanley.mountain
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/pm8001/pm8001_ctl.c

index bb38b2d63acb87489783ae2240e6fa684fd0ab10..a27f3287748eeb24d0aed3b80428f509ee1dc5c3 100644 (file)
@@ -588,10 +588,7 @@ static DEVICE_ATTR(fatal_log, S_IRUGO, pm8001_ctl_fatal_log_show, NULL);
 static ssize_t non_fatal_log_show(struct device *cdev,
        struct device_attribute *attr, char *buf)
 {
-       u32 count;
-
-       count = pm80xx_get_non_fatal_dump(cdev, attr, buf);
-       return count;
+       return pm80xx_get_non_fatal_dump(cdev, attr, buf);
 }
 static DEVICE_ATTR_RO(non_fatal_log);