Skip to content

Commit 7195c87

Browse files
Dan CarpenterKalle Valo
authored andcommitted
ath11k: fix up some error paths
There are two error paths where "ret" wasn't set. Also one error path we set the error code to -EINVAL but we should just preserve the error code from ath11k_hal_srng_get_entrysize(). That function only returns -EINVAL so this doesn't change anything. I removed the "ret = 0;" initializers so that hopefully GCC will be able to detect these sorts of bugs in the future. Fixes: d5c6515 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent 93634c6 commit 7195c87

File tree

1 file changed

+11
-11
lines changed
  • drivers/net/wireless/ath/ath11k

1 file changed

+11
-11
lines changed

drivers/net/wireless/ath/ath11k/dp_tx.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ int ath11k_dp_tx_htt_srng_setup(struct ath11k_base *ab, u32 ring_id,
630630
dma_addr_t hp_addr, tp_addr;
631631
enum htt_srng_ring_type htt_ring_type;
632632
enum htt_srng_ring_id htt_ring_id;
633-
int ret = 0;
633+
int ret;
634634

635635
skb = ath11k_htc_alloc_skb(ab, len);
636636
if (!skb)
@@ -642,9 +642,10 @@ int ath11k_dp_tx_htt_srng_setup(struct ath11k_base *ab, u32 ring_id,
642642
hp_addr = ath11k_hal_srng_get_hp_addr(ab, srng);
643643
tp_addr = ath11k_hal_srng_get_tp_addr(ab, srng);
644644

645-
if (ath11k_dp_tx_get_ring_id_type(ab, mac_id, ring_id,
646-
ring_type, &htt_ring_type,
647-
&htt_ring_id))
645+
ret = ath11k_dp_tx_get_ring_id_type(ab, mac_id, ring_id,
646+
ring_type, &htt_ring_type,
647+
&htt_ring_id);
648+
if (ret)
648649
goto err_free;
649650

650651
skb_put(skb, len);
@@ -669,10 +670,8 @@ int ath11k_dp_tx_htt_srng_setup(struct ath11k_base *ab, u32 ring_id,
669670
HAL_ADDR_MSB_REG_SHIFT;
670671

671672
ret = ath11k_hal_srng_get_entrysize(ring_type);
672-
if (ret < 0) {
673-
ret = -EINVAL;
673+
if (ret < 0)
674674
goto err_free;
675-
}
676675

677676
ring_entry_sz = ret;
678677

@@ -817,7 +816,7 @@ int ath11k_dp_tx_htt_rx_filter_setup(struct ath11k_base *ab, u32 ring_id,
817816
int len = sizeof(*cmd);
818817
enum htt_srng_ring_type htt_ring_type;
819818
enum htt_srng_ring_id htt_ring_id;
820-
int ret = 0;
819+
int ret;
821820

822821
skb = ath11k_htc_alloc_skb(ab, len);
823822
if (!skb)
@@ -826,9 +825,10 @@ int ath11k_dp_tx_htt_rx_filter_setup(struct ath11k_base *ab, u32 ring_id,
826825
memset(&params, 0, sizeof(params));
827826
ath11k_hal_srng_get_params(ab, srng, &params);
828827

829-
if (ath11k_dp_tx_get_ring_id_type(ab, mac_id, ring_id,
830-
ring_type, &htt_ring_type,
831-
&htt_ring_id))
828+
ret = ath11k_dp_tx_get_ring_id_type(ab, mac_id, ring_id,
829+
ring_type, &htt_ring_type,
830+
&htt_ring_id);
831+
if (ret)
832832
goto err_free;
833833

834834
skb_put(skb, len);

0 commit comments

Comments
 (0)