diff mbox series

ath10k: fix array_size.cocci warnings

Message ID 20181011124115.GA49377@lkp-hsx02.lkp.intel.com (mailing list archive)
State New, archived
Headers show
Series ath10k: fix array_size.cocci warnings | expand

Commit Message

Fengguang Wu Oct. 11, 2018, 12:41 p.m. UTC
From: kbuild test robot <fengguang.wu@intel.com>

drivers/net/wireless/ath/ath10k/snoc.c:984:58-59: WARNING: Use ARRAY_SIZE

 Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element

Semantic patch information:
 This makes an effort to find cases where ARRAY_SIZE can be used such as
 where there is a division of sizeof the array by the sizeof its first
 element or by any indexed element or the element type. It replaces the
 division of the two sizeofs by ARRAY_SIZE.

Generated by: scripts/coccinelle/misc/array_size.cocci

Fixes: 5639a5d3cc24 ("ath10k: Add QMI message handshake for wcn3990 client")
CC: Govind Singh <govinds@codeaurora.org>
Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git pending
head:   54a7bb96eb4b7f8171448dfaa5173c88cd3c29e1
commit: 5639a5d3cc242473d600a400dc41edcbb0b19092 [26/28] ath10k: Add QMI message handshake for wcn3990 client

 snoc.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Kalle Valo Oct. 12, 2018, 2:40 p.m. UTC | #1
kbuild test robot <fengguang.wu@intel.com> writes:

> From: kbuild test robot <fengguang.wu@intel.com>
>
> drivers/net/wireless/ath/ath10k/snoc.c:984:58-59: WARNING: Use ARRAY_SIZE
>
>  Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element
>
> Semantic patch information:
>  This makes an effort to find cases where ARRAY_SIZE can be used such as
>  where there is a division of sizeof the array by the sizeof its first
>  element or by any indexed element or the element type. It replaces the
>  division of the two sizeofs by ARRAY_SIZE.
>
> Generated by: scripts/coccinelle/misc/array_size.cocci
>
> Fixes: 5639a5d3cc24 ("ath10k: Add QMI message handshake for wcn3990 client")
> CC: Govind Singh <govinds@codeaurora.org>
> Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
> ---
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git pending
> head:   54a7bb96eb4b7f8171448dfaa5173c88cd3c29e1
> commit: 5639a5d3cc242473d600a400dc41edcbb0b19092 [26/28] ath10k: Add QMI message handshake for wcn3990 client
>
>  snoc.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> --- a/drivers/net/wireless/ath/ath10k/snoc.c
> +++ b/drivers/net/wireless/ath/ath10k/snoc.c
> @@ -981,8 +981,7 @@ static int ath10k_snoc_wlan_enable(struc
>  				  sizeof(struct ath10k_svc_pipe_cfg);
>  	cfg.ce_svc_cfg = (struct ath10k_svc_pipe_cfg *)
>  		&target_service_to_ce_map_wlan;
> -	cfg.num_shadow_reg_cfg = sizeof(target_shadow_reg_cfg_map) /
> -					sizeof(struct ath10k_shadow_reg_cfg);
> +	cfg.num_shadow_reg_cfg = ARRAY_SIZE(target_shadow_reg_cfg_map);
>  	cfg.shadow_reg_cfg = (struct ath10k_shadow_reg_cfg *)
>  		&target_shadow_reg_cfg_map;

Looks good, but please resubmit and CC linux-wireless so that patchwork
sees this.
diff mbox series

Patch

--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -981,8 +981,7 @@  static int ath10k_snoc_wlan_enable(struc
 				  sizeof(struct ath10k_svc_pipe_cfg);
 	cfg.ce_svc_cfg = (struct ath10k_svc_pipe_cfg *)
 		&target_service_to_ce_map_wlan;
-	cfg.num_shadow_reg_cfg = sizeof(target_shadow_reg_cfg_map) /
-					sizeof(struct ath10k_shadow_reg_cfg);
+	cfg.num_shadow_reg_cfg = ARRAY_SIZE(target_shadow_reg_cfg_map);
 	cfg.shadow_reg_cfg = (struct ath10k_shadow_reg_cfg *)
 		&target_shadow_reg_cfg_map;