Re: [PATCH 2/2] net/mlx4_core: clean up srq_res_start_move_to()

From: Jack Morgenstein
Date: Tue Jan 14 2014 - 01:41:13 EST


On Tue, 07 Jan 2014 14:02:14 +0100
Paul Bolle <pebolle@xxxxxxxxxx> wrote:

> diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
> b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index
> a41f01e..8ace450 100644 ---
> a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++
> b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c @@ -1372,7
> +1372,7 @@ static int cq_res_start_move_to(struct mlx4_dev *dev, int
> slave, int cqn, }
> static int srq_res_start_move_to(struct mlx4_dev *dev, int slave,
> int index,
> - enum res_cq_states state, struct res_srq **srq)
> + enum res_srq_states state, struct res_srq **srq) {

ACK


> + /* state == RES_SRQ_HW */
> + if (r->com.state != RES_SRQ_ALLOCATED)

if (state != RES_SRQ_HW || r->com.state != RES_SRQ_ALLOCATED)

> err = -EINVAL;
> - }
> + }
>
> - if (!err) {
> - r->com.from_state = r->com.state;
> - r->com.to_state = state;
> - r->com.state = RES_SRQ_BUSY;
> - if (srq)
> - *srq = r;
> - }
> + if (!err) {
> + r->com.from_state = r->com.state;
> + r->com.to_state = state;
> + r->com.state = RES_SRQ_BUSY;
please leave in the if (srq). Not currently needed, but if this
changes in the future, we will get an Oops.
> + *srq = r;
> }
>
> spin_unlock_irq(mlx4_tlock(dev));

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/