diff options
author | Eyal Perry <eyalpe@mellanox.com> | 2014-05-14 05:15:13 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-05-14 15:40:33 -0400 |
commit | c05a116f397242e0ed4353bb4d36671a1f86ec77 (patch) | |
tree | 5af96ab175fdb0adecc4496fe46363f0732f4e76 | |
parent | ee755324a3aa1459c7e184e12c170b89bd159f22 (diff) |
net/mlx4_core: Fix smatch error - possible access to a null variable
Fix the "error: we previously assumed 'out_param' could be null" found
by smatch semantic checker on:
drivers/net/ethernet/mellanox/mlx4/cmd.c:506 mlx4_cmd_poll()
drivers/net/ethernet/mellanox/mlx4/cmd.c:578 mlx4_cmd_wait()
Signed-off-by: Eyal Perry <eyalpe@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/cmd.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c index 24201033661b..357dcb0f04fb 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c | |||
@@ -473,6 +473,13 @@ static int mlx4_cmd_poll(struct mlx4_dev *dev, u64 in_param, u64 *out_param, | |||
473 | goto out; | 473 | goto out; |
474 | } | 474 | } |
475 | 475 | ||
476 | if (out_is_imm && !out_param) { | ||
477 | mlx4_err(dev, "response expected while output mailbox is NULL for command 0x%x\n", | ||
478 | op); | ||
479 | err = -EINVAL; | ||
480 | goto out; | ||
481 | } | ||
482 | |||
476 | err = mlx4_cmd_post(dev, in_param, out_param ? *out_param : 0, | 483 | err = mlx4_cmd_post(dev, in_param, out_param ? *out_param : 0, |
477 | in_modifier, op_modifier, op, CMD_POLL_TOKEN, 0); | 484 | in_modifier, op_modifier, op, CMD_POLL_TOKEN, 0); |
478 | if (err) | 485 | if (err) |
@@ -551,6 +558,13 @@ static int mlx4_cmd_wait(struct mlx4_dev *dev, u64 in_param, u64 *out_param, | |||
551 | cmd->free_head = context->next; | 558 | cmd->free_head = context->next; |
552 | spin_unlock(&cmd->context_lock); | 559 | spin_unlock(&cmd->context_lock); |
553 | 560 | ||
561 | if (out_is_imm && !out_param) { | ||
562 | mlx4_err(dev, "response expected while output mailbox is NULL for command 0x%x\n", | ||
563 | op); | ||
564 | err = -EINVAL; | ||
565 | goto out; | ||
566 | } | ||
567 | |||
554 | init_completion(&context->done); | 568 | init_completion(&context->done); |
555 | 569 | ||
556 | mlx4_cmd_post(dev, in_param, out_param ? *out_param : 0, | 570 | mlx4_cmd_post(dev, in_param, out_param ? *out_param : 0, |