All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ath11k: fix warning in ath11k_mhi_config
@ 2021-04-08  4:57 ` Anilkumar Kolli
  0 siblings, 0 replies; 4+ messages in thread
From: Anilkumar Kolli @ 2021-04-08  4:57 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Anilkumar Kolli

Initialize static variable ath11k_mhi_config for all hw_rev,
return error for unknown hw_rev.
This patch fixes below Smatch warning:
    drivers/net/wireless/ath/ath11k/mhi.c:357 ath11k_mhi_register()
    error: uninitialized symbol 'ath11k_mhi_config'.

Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1-01734-QCAHKSWPL_SILICONZ-1

Fixes: a233811ef600 ("ath11k: Add qcn9074 mhi controller config")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Anilkumar Kolli <akolli@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/mhi.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/mhi.c b/drivers/net/wireless/ath/ath11k/mhi.c
index 626764da4d6f..27b394d115e2 100644
--- a/drivers/net/wireless/ath/ath11k/mhi.c
+++ b/drivers/net/wireless/ath/ath11k/mhi.c
@@ -349,10 +349,19 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci)
 	mhi_ctrl->read_reg = ath11k_mhi_op_read_reg;
 	mhi_ctrl->write_reg = ath11k_mhi_op_write_reg;
 
-	if (ab->hw_rev == ATH11K_HW_QCA6390_HW20)
-		ath11k_mhi_config = &ath11k_mhi_config_qca6390;
-	else if (ab->hw_rev == ATH11K_HW_QCN9074_HW10)
+	switch (ab->hw_rev) {
+	case ATH11K_HW_QCN9074_HW10:
 		ath11k_mhi_config = &ath11k_mhi_config_qcn9074;
+		break;
+	case ATH11K_HW_QCA6390_HW20:
+		ath11k_mhi_config = &ath11k_mhi_config_qca6390;
+		break;
+	default:
+		ath11k_err(ab, "failed assign mhi_config for unknown hw rev %d\n",
+			   ab->hw_rev);
+		mhi_free_controller(mhi_ctrl);
+		return -EINVAL;
+	}
 
 	ret = mhi_register_controller(mhi_ctrl, ath11k_mhi_config);
 	if (ret) {
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] ath11k: fix warning in ath11k_mhi_config
@ 2021-04-08  4:57 ` Anilkumar Kolli
  0 siblings, 0 replies; 4+ messages in thread
From: Anilkumar Kolli @ 2021-04-08  4:57 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Anilkumar Kolli

Initialize static variable ath11k_mhi_config for all hw_rev,
return error for unknown hw_rev.
This patch fixes below Smatch warning:
    drivers/net/wireless/ath/ath11k/mhi.c:357 ath11k_mhi_register()
    error: uninitialized symbol 'ath11k_mhi_config'.

Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1-01734-QCAHKSWPL_SILICONZ-1

Fixes: a233811ef600 ("ath11k: Add qcn9074 mhi controller config")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Anilkumar Kolli <akolli@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/mhi.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/mhi.c b/drivers/net/wireless/ath/ath11k/mhi.c
index 626764da4d6f..27b394d115e2 100644
--- a/drivers/net/wireless/ath/ath11k/mhi.c
+++ b/drivers/net/wireless/ath/ath11k/mhi.c
@@ -349,10 +349,19 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci)
 	mhi_ctrl->read_reg = ath11k_mhi_op_read_reg;
 	mhi_ctrl->write_reg = ath11k_mhi_op_write_reg;
 
-	if (ab->hw_rev == ATH11K_HW_QCA6390_HW20)
-		ath11k_mhi_config = &ath11k_mhi_config_qca6390;
-	else if (ab->hw_rev == ATH11K_HW_QCN9074_HW10)
+	switch (ab->hw_rev) {
+	case ATH11K_HW_QCN9074_HW10:
 		ath11k_mhi_config = &ath11k_mhi_config_qcn9074;
+		break;
+	case ATH11K_HW_QCA6390_HW20:
+		ath11k_mhi_config = &ath11k_mhi_config_qca6390;
+		break;
+	default:
+		ath11k_err(ab, "failed assign mhi_config for unknown hw rev %d\n",
+			   ab->hw_rev);
+		mhi_free_controller(mhi_ctrl);
+		return -EINVAL;
+	}
 
 	ret = mhi_register_controller(mhi_ctrl, ath11k_mhi_config);
 	if (ret) {
-- 
2.7.4


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ath11k: fix warning in ath11k_mhi_config
  2021-04-08  4:57 ` Anilkumar Kolli
  (?)
  (?)
@ 2021-04-22 14:05 ` Kalle Valo
  -1 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2021-04-22 14:05 UTC (permalink / raw)
  To: Anilkumar Kolli; +Cc: ath11k, linux-wireless, Anilkumar Kolli

Anilkumar Kolli <akolli@codeaurora.org> wrote:

> Initialize static variable ath11k_mhi_config for all hw_rev,
> return error for unknown hw_rev.
> This patch fixes below Smatch warning:
>     drivers/net/wireless/ath/ath11k/mhi.c:357 ath11k_mhi_register()
>     error: uninitialized symbol 'ath11k_mhi_config'.
> 
> Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1-01734-QCAHKSWPL_SILICONZ-1
> 
> Fixes: a233811ef600 ("ath11k: Add qcn9074 mhi controller config")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Anilkumar Kolli <akolli@codeaurora.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

Patch applied to ath-next branch of ath.git, thanks.

ff9f732a87ca ath11k: fix warning in ath11k_mhi_config

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/1617857830-19315-1-git-send-email-akolli@codeaurora.org/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ath11k: fix warning in ath11k_mhi_config
  2021-04-08  4:57 ` Anilkumar Kolli
  (?)
@ 2021-04-22 14:05 ` Kalle Valo
  -1 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2021-04-22 14:05 UTC (permalink / raw)
  To: Anilkumar Kolli; +Cc: ath11k, linux-wireless, Anilkumar Kolli

Anilkumar Kolli <akolli@codeaurora.org> wrote:

> Initialize static variable ath11k_mhi_config for all hw_rev,
> return error for unknown hw_rev.
> This patch fixes below Smatch warning:
>     drivers/net/wireless/ath/ath11k/mhi.c:357 ath11k_mhi_register()
>     error: uninitialized symbol 'ath11k_mhi_config'.
> 
> Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1-01734-QCAHKSWPL_SILICONZ-1
> 
> Fixes: a233811ef600 ("ath11k: Add qcn9074 mhi controller config")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Anilkumar Kolli <akolli@codeaurora.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

Patch applied to ath-next branch of ath.git, thanks.

ff9f732a87ca ath11k: fix warning in ath11k_mhi_config

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/1617857830-19315-1-git-send-email-akolli@codeaurora.org/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-22 14:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08  4:57 [PATCH] ath11k: fix warning in ath11k_mhi_config Anilkumar Kolli
2021-04-08  4:57 ` Anilkumar Kolli
2021-04-22 14:05 ` Kalle Valo
2021-04-22 14:05 ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.