Commit c76fa846 authored by Dan Carpenter's avatar Dan Carpenter Committed by Kalle Valo

ath11k: checking for NULL vs IS_ERR()

The ath11k_ce_alloc_ring() function returns error pointers on error, not
NULL.  The rest of the driver assumes that "pipe->src_ring" is either
valid or NULL so this patch introduces a temporary varaible to avoid
leaving it as an error pointer.

Fixes: d5c65159 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent cd21c827
...@@ -441,6 +441,7 @@ static int ath11k_ce_alloc_pipe(struct ath11k_base *ab, int ce_id) ...@@ -441,6 +441,7 @@ static int ath11k_ce_alloc_pipe(struct ath11k_base *ab, int ce_id)
{ {
struct ath11k_ce_pipe *pipe = &ab->ce.ce_pipe[ce_id]; struct ath11k_ce_pipe *pipe = &ab->ce.ce_pipe[ce_id];
const struct ce_attr *attr = &host_ce_config_wlan[ce_id]; const struct ce_attr *attr = &host_ce_config_wlan[ce_id];
struct ath11k_ce_ring *ring;
int nentries; int nentries;
int desc_sz; int desc_sz;
...@@ -450,24 +451,26 @@ static int ath11k_ce_alloc_pipe(struct ath11k_base *ab, int ce_id) ...@@ -450,24 +451,26 @@ static int ath11k_ce_alloc_pipe(struct ath11k_base *ab, int ce_id)
pipe->send_cb = ath11k_ce_send_done_cb; pipe->send_cb = ath11k_ce_send_done_cb;
nentries = roundup_pow_of_two(attr->src_nentries); nentries = roundup_pow_of_two(attr->src_nentries);
desc_sz = ath11k_hal_ce_get_desc_size(HAL_CE_DESC_SRC); desc_sz = ath11k_hal_ce_get_desc_size(HAL_CE_DESC_SRC);
pipe->src_ring = ath11k_ce_alloc_ring(ab, nentries, desc_sz); ring = ath11k_ce_alloc_ring(ab, nentries, desc_sz);
if (!pipe->src_ring) if (IS_ERR(ring))
return -ENOMEM; return PTR_ERR(ring);
pipe->src_ring = ring;
} }
if (attr->dest_nentries) { if (attr->dest_nentries) {
pipe->recv_cb = attr->recv_cb; pipe->recv_cb = attr->recv_cb;
nentries = roundup_pow_of_two(attr->dest_nentries); nentries = roundup_pow_of_two(attr->dest_nentries);
desc_sz = ath11k_hal_ce_get_desc_size(HAL_CE_DESC_DST); desc_sz = ath11k_hal_ce_get_desc_size(HAL_CE_DESC_DST);
pipe->dest_ring = ath11k_ce_alloc_ring(ab, nentries, desc_sz); ring = ath11k_ce_alloc_ring(ab, nentries, desc_sz);
if (IS_ERR(ring))
if (!pipe->dest_ring) return PTR_ERR(ring);
return -ENOMEM; pipe->dest_ring = ring;
desc_sz = ath11k_hal_ce_get_desc_size(HAL_CE_DESC_DST_STATUS); desc_sz = ath11k_hal_ce_get_desc_size(HAL_CE_DESC_DST_STATUS);
pipe->status_ring = ath11k_ce_alloc_ring(ab, nentries, desc_sz); ring = ath11k_ce_alloc_ring(ab, nentries, desc_sz);
if (!pipe->status_ring) if (IS_ERR(ring))
return -ENOMEM; return PTR_ERR(ring);
pipe->status_ring = ring;
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment