diff mbox series

scsi: qla2xxx: check for kstrtol() failure

Message ID 20190220053913.GA25196@kadam (mailing list archive)
State Mainlined
Commit b8870ec63676aba1d823f0b36c5f7e9929e57d23
Headers show
Series scsi: qla2xxx: check for kstrtol() failure | expand

Commit Message

Dan Carpenter Feb. 20, 2019, 5:39 a.m. UTC
The error handling was unintentionally left out so it introduces a
Smatch static checker warning:

    drivers/scsi/qla2xxx/qla_attr.c:1655 qla2x00_port_speed_store()
    error: uninitialized symbol 'type'.

Fixes: a7b9ca7fc87a ("scsi: qla2xxx: Add support for setting port speed")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/scsi/qla2xxx/qla_attr.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Martin K. Petersen March 7, 2019, 12:19 a.m. UTC | #1
Dan,

> The error handling was unintentionally left out so it introduces a
> Smatch static checker warning:
>
>     drivers/scsi/qla2xxx/qla_attr.c:1655 qla2x00_port_speed_store()
>     error: uninitialized symbol 'type'.

Applied to 5.1/scsi-queue, thanks!
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 2eb1ae721a7d..f928c4d3a1ef 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1652,6 +1652,8 @@  qla2x00_port_speed_store(struct device *dev, struct device_attribute *attr,
 	}
 
 	rval = kstrtol(buf, 10, &type);
+	if (rval)
+		return rval;
 	speed = type;
 	if (type == 40 || type == 80 || type == 160 ||
 	    type == 320) {