diff options
author | Sagi Grimberg <sagig@mellanox.com> | 2015-06-25 13:34:15 +0300 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2015-07-14 20:20:09 +0300 |
commit | 3fdf70acec13efc7ecf254f5a364df06348bfd2c (patch) | |
tree | 9c463c5431b02863acc8a4af9ed02796b01aa232 /drivers/infiniband | |
parent | b356c1c1f90a347b6f67d9272dda7ecf47e0b46c (diff) | |
download | linux-3fdf70acec13efc7ecf254f5a364df06348bfd2c.tar.xz |
IB/srp: Avoid using uninitialized variable
We might return res which is not initialized. Also
reduce code duplication by exporting srp_parse_tmo so
srp_tmo_set can reuse it.
Detected by Coverity.
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Jenny Falkovich <jennyf@mellanox.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/ulp/srp/ib_srp.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index d40e321768a0..31a20b462266 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -161,13 +161,10 @@ static int srp_tmo_set(const char *val, const struct kernel_param *kp) { int tmo, res; - if (strncmp(val, "off", 3) != 0) { - res = kstrtoint(val, 0, &tmo); - if (res) - goto out; - } else { - tmo = -1; - } + res = srp_parse_tmo(&tmo, val); + if (res) + goto out; + if (kp->arg == &srp_reconnect_delay) res = srp_tmo_valid(tmo, srp_fast_io_fail_tmo, srp_dev_loss_tmo); |