ath10k.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [ath6kl:pending 10/12] drivers/net/wireless/ath/ath10k/mac.c:3010 ath10k_mac_set_sar_specs() warn: this array is probably non-NULL. 'sar->sub_specs'
@ 2021-01-22 15:07 Dan Carpenter
  2021-01-27 10:52 ` Kalle Valo
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2021-01-22 15:07 UTC (permalink / raw)
  To: kbuild, Carl Huang
  Cc: Abhishek Kumar, kbuild-all, lkp, Brian Norris, ath10k, Kalle Valo

[-- Attachment #1: Type: text/plain, Size: 4345 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git pending
head:   13112a10a90ece17774a25bc363a7561c26aa19f
commit: c995c0bdf2d68ce279507a2017e1e65e823339df [10/12] ath10k: allow dynamic SAR power limits via common API
config: x86_64-randconfig-m001-20210121 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/net/wireless/ath/ath10k/mac.c:3010 ath10k_mac_set_sar_specs() warn: this array is probably non-NULL. 'sar->sub_specs'

Old smatch warnings:
drivers/net/wireless/ath/ath10k/mac.c:5150 ath10k_start() warn: missing error code 'ret'
drivers/net/wireless/ath/ath10k/mac.c:5589 ath10k_add_interface() warn: missing error code 'ret'

vim +3010 drivers/net/wireless/ath/ath10k/mac.c

c995c0bdf2d68ce Carl Huang 2021-01-18  2993  
c995c0bdf2d68ce Carl Huang 2021-01-18  2994  static int ath10k_mac_set_sar_specs(struct ieee80211_hw *hw,
c995c0bdf2d68ce Carl Huang 2021-01-18  2995  				    const struct cfg80211_sar_specs *sar)
c995c0bdf2d68ce Carl Huang 2021-01-18  2996  {
c995c0bdf2d68ce Carl Huang 2021-01-18  2997  	const struct cfg80211_sar_sub_specs *sub_specs;
c995c0bdf2d68ce Carl Huang 2021-01-18  2998  	struct ath10k *ar = hw->priv;
c995c0bdf2d68ce Carl Huang 2021-01-18  2999  	u32 i;
c995c0bdf2d68ce Carl Huang 2021-01-18  3000  	int ret;
c995c0bdf2d68ce Carl Huang 2021-01-18  3001  
c995c0bdf2d68ce Carl Huang 2021-01-18  3002  	mutex_lock(&ar->conf_mutex);
c995c0bdf2d68ce Carl Huang 2021-01-18  3003  
c995c0bdf2d68ce Carl Huang 2021-01-18  3004  	if (!ar->hw_params.dynamic_sar_support) {
c995c0bdf2d68ce Carl Huang 2021-01-18  3005  		ret = -EOPNOTSUPP;
c995c0bdf2d68ce Carl Huang 2021-01-18  3006  		goto error;
c995c0bdf2d68ce Carl Huang 2021-01-18  3007  	}
c995c0bdf2d68ce Carl Huang 2021-01-18  3008  
c995c0bdf2d68ce Carl Huang 2021-01-18  3009  	if (!sar || sar->type != NL80211_SAR_TYPE_POWER ||
c995c0bdf2d68ce Carl Huang 2021-01-18 @3010  	    sar->num_sub_specs == 0 || !sar->sub_specs) {
                                                                               ^^^^^^^^^^^^^^^
You could delete this if you want.  It can't be NULL.

c995c0bdf2d68ce Carl Huang 2021-01-18  3011  		ret = -EINVAL;
c995c0bdf2d68ce Carl Huang 2021-01-18  3012  		goto error;
c995c0bdf2d68ce Carl Huang 2021-01-18  3013  	}
c995c0bdf2d68ce Carl Huang 2021-01-18  3014  
c995c0bdf2d68ce Carl Huang 2021-01-18  3015  	sub_specs = sar->sub_specs;
c995c0bdf2d68ce Carl Huang 2021-01-18  3016  
c995c0bdf2d68ce Carl Huang 2021-01-18  3017  	/* 0dbm is not a practical value for ath10k, so use 0
c995c0bdf2d68ce Carl Huang 2021-01-18  3018  	 * as no SAR limitation on it.
c995c0bdf2d68ce Carl Huang 2021-01-18  3019  	 */
c995c0bdf2d68ce Carl Huang 2021-01-18  3020  	ar->tx_power_2g_limit = 0;
c995c0bdf2d68ce Carl Huang 2021-01-18  3021  	ar->tx_power_5g_limit = 0;
c995c0bdf2d68ce Carl Huang 2021-01-18  3022  
c995c0bdf2d68ce Carl Huang 2021-01-18  3023  	/* note the power is in 0.25dbm unit, while ath10k uses
c995c0bdf2d68ce Carl Huang 2021-01-18  3024  	 * 0.5dbm unit.
c995c0bdf2d68ce Carl Huang 2021-01-18  3025  	 */
c995c0bdf2d68ce Carl Huang 2021-01-18  3026  	for (i = 0; i < sar->num_sub_specs; i++) {
c995c0bdf2d68ce Carl Huang 2021-01-18  3027  		if (sub_specs->freq_range_index == 0)
c995c0bdf2d68ce Carl Huang 2021-01-18  3028  			ar->tx_power_2g_limit = sub_specs->power / 2;
c995c0bdf2d68ce Carl Huang 2021-01-18  3029  		else if (sub_specs->freq_range_index == 1)
c995c0bdf2d68ce Carl Huang 2021-01-18  3030  			ar->tx_power_5g_limit = sub_specs->power / 2;
c995c0bdf2d68ce Carl Huang 2021-01-18  3031  
c995c0bdf2d68ce Carl Huang 2021-01-18  3032  		sub_specs++;
c995c0bdf2d68ce Carl Huang 2021-01-18  3033  	}
c995c0bdf2d68ce Carl Huang 2021-01-18  3034  
c995c0bdf2d68ce Carl Huang 2021-01-18  3035  	ret = ath10k_mac_set_sar_power(ar);
c995c0bdf2d68ce Carl Huang 2021-01-18  3036  error:
c995c0bdf2d68ce Carl Huang 2021-01-18  3037  	mutex_unlock(&ar->conf_mutex);
c995c0bdf2d68ce Carl Huang 2021-01-18  3038  	return ret;
c995c0bdf2d68ce Carl Huang 2021-01-18  3039  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38648 bytes --]

[-- Attachment #3: Type: text/plain, Size: 146 bytes --]

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

* Re: [ath6kl:pending 10/12] drivers/net/wireless/ath/ath10k/mac.c:3010 ath10k_mac_set_sar_specs() warn: this array is probably non-NULL. 'sar->sub_specs'
  2021-01-22 15:07 [ath6kl:pending 10/12] drivers/net/wireless/ath/ath10k/mac.c:3010 ath10k_mac_set_sar_specs() warn: this array is probably non-NULL. 'sar->sub_specs' Dan Carpenter
@ 2021-01-27 10:52 ` Kalle Valo
  2021-01-27 10:58   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Kalle Valo @ 2021-01-27 10:52 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Abhishek Kumar, Brian Norris, kbuild-all, lkp, kbuild,
	Carl Huang, ath10k

Dan Carpenter <dan.carpenter@oracle.com> writes:

> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git pending
> head:   13112a10a90ece17774a25bc363a7561c26aa19f
> commit: c995c0bdf2d68ce279507a2017e1e65e823339df [10/12] ath10k: allow
> dynamic SAR power limits via common API
> config: x86_64-randconfig-m001-20210121 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> New smatch warnings:
> drivers/net/wireless/ath/ath10k/mac.c:3010 ath10k_mac_set_sar_specs()
> warn: this array is probably non-NULL. 'sar->sub_specs'
>
> Old smatch warnings:
> drivers/net/wireless/ath/ath10k/mac.c:5150 ath10k_start() warn:
> missing error code 'ret'
> drivers/net/wireless/ath/ath10k/mac.c:5589 ath10k_add_interface()
> warn: missing error code 'ret'
>
> vim +3010 drivers/net/wireless/ath/ath10k/mac.c
>
> c995c0bdf2d68ce Carl Huang 2021-01-18  2993  
> c995c0bdf2d68ce Carl Huang 2021-01-18 2994 static int
> ath10k_mac_set_sar_specs(struct ieee80211_hw *hw,
> c995c0bdf2d68ce Carl Huang 2021-01-18 2995 const struct
> cfg80211_sar_specs *sar)
> c995c0bdf2d68ce Carl Huang 2021-01-18  2996  {
> c995c0bdf2d68ce Carl Huang 2021-01-18 2997 const struct
> cfg80211_sar_sub_specs *sub_specs;
> c995c0bdf2d68ce Carl Huang 2021-01-18  2998  	struct ath10k *ar = hw->priv;
> c995c0bdf2d68ce Carl Huang 2021-01-18  2999  	u32 i;
> c995c0bdf2d68ce Carl Huang 2021-01-18  3000  	int ret;
> c995c0bdf2d68ce Carl Huang 2021-01-18  3001  
> c995c0bdf2d68ce Carl Huang 2021-01-18  3002  	mutex_lock(&ar->conf_mutex);
> c995c0bdf2d68ce Carl Huang 2021-01-18  3003  
> c995c0bdf2d68ce Carl Huang 2021-01-18 3004 if
> (!ar->hw_params.dynamic_sar_support) {
> c995c0bdf2d68ce Carl Huang 2021-01-18  3005  		ret = -EOPNOTSUPP;
> c995c0bdf2d68ce Carl Huang 2021-01-18  3006  		goto error;
> c995c0bdf2d68ce Carl Huang 2021-01-18  3007  	}
> c995c0bdf2d68ce Carl Huang 2021-01-18  3008  
> c995c0bdf2d68ce Carl Huang 2021-01-18 3009 if (!sar || sar->type !=
> NL80211_SAR_TYPE_POWER ||
> c995c0bdf2d68ce Carl Huang 2021-01-18 @3010 sar->num_sub_specs == 0 ||
> !sar->sub_specs) {
>                                                                                ^^^^^^^^^^^^^^^
> You could delete this if you want.  It can't be NULL.

I removed !sar->sub_specs (I hope that's what you meant) in the in the
pending branch, thanks.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

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

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

* Re: [ath6kl:pending 10/12] drivers/net/wireless/ath/ath10k/mac.c:3010 ath10k_mac_set_sar_specs() warn: this array is probably non-NULL. 'sar->sub_specs'
  2021-01-27 10:52 ` Kalle Valo
@ 2021-01-27 10:58   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-01-27 10:58 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Abhishek Kumar, Brian Norris, kbuild-all, lkp, kbuild,
	Carl Huang, ath10k

On Wed, Jan 27, 2021 at 12:52:09PM +0200, Kalle Valo wrote:
> Dan Carpenter <dan.carpenter@oracle.com> writes:
> 
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git  pending
> > head:   13112a10a90ece17774a25bc363a7561c26aa19f
> > commit: c995c0bdf2d68ce279507a2017e1e65e823339df [10/12] ath10k: allow
> > dynamic SAR power limits via common API
> > config: x86_64-randconfig-m001-20210121 (attached as .config)
> > compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> >
> > New smatch warnings:
> > drivers/net/wireless/ath/ath10k/mac.c:3010 ath10k_mac_set_sar_specs()
> > warn: this array is probably non-NULL. 'sar->sub_specs'
> >
> > Old smatch warnings:
> > drivers/net/wireless/ath/ath10k/mac.c:5150 ath10k_start() warn:
> > missing error code 'ret'
> > drivers/net/wireless/ath/ath10k/mac.c:5589 ath10k_add_interface()
> > warn: missing error code 'ret'
> >
> > vim +3010 drivers/net/wireless/ath/ath10k/mac.c
> >
> > c995c0bdf2d68ce Carl Huang 2021-01-18  2993  
> > c995c0bdf2d68ce Carl Huang 2021-01-18 2994 static int
> > ath10k_mac_set_sar_specs(struct ieee80211_hw *hw,
> > c995c0bdf2d68ce Carl Huang 2021-01-18 2995 const struct
> > cfg80211_sar_specs *sar)
> > c995c0bdf2d68ce Carl Huang 2021-01-18  2996  {
> > c995c0bdf2d68ce Carl Huang 2021-01-18 2997 const struct
> > cfg80211_sar_sub_specs *sub_specs;
> > c995c0bdf2d68ce Carl Huang 2021-01-18  2998  	struct ath10k *ar = hw->priv;
> > c995c0bdf2d68ce Carl Huang 2021-01-18  2999  	u32 i;
> > c995c0bdf2d68ce Carl Huang 2021-01-18  3000  	int ret;
> > c995c0bdf2d68ce Carl Huang 2021-01-18  3001  
> > c995c0bdf2d68ce Carl Huang 2021-01-18  3002  	mutex_lock(&ar->conf_mutex);
> > c995c0bdf2d68ce Carl Huang 2021-01-18  3003  
> > c995c0bdf2d68ce Carl Huang 2021-01-18 3004 if
> > (!ar->hw_params.dynamic_sar_support) {
> > c995c0bdf2d68ce Carl Huang 2021-01-18  3005  		ret = -EOPNOTSUPP;
> > c995c0bdf2d68ce Carl Huang 2021-01-18  3006  		goto error;
> > c995c0bdf2d68ce Carl Huang 2021-01-18  3007  	}
> > c995c0bdf2d68ce Carl Huang 2021-01-18  3008  
> > c995c0bdf2d68ce Carl Huang 2021-01-18 3009 if (!sar || sar->type !=
> > NL80211_SAR_TYPE_POWER ||
> > c995c0bdf2d68ce Carl Huang 2021-01-18 @3010 sar->num_sub_specs == 0 ||
> > !sar->sub_specs) {
> >                                                                                ^^^^^^^^^^^^^^^
> > You could delete this if you want.  It can't be NULL.
> 
> I removed !sar->sub_specs (I hope that's what you meant) in the in the
> pending branch, thanks.

Yeah.  No need to check.  It's the address of an array and the array is
not the first struct member.  And even ->sub_specs was the first
struct member then we know "sar" is non-NULL so there is no way
sar->sub_specs can be NULL.

regards,
dan carpenter


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

end of thread, other threads:[~2021-01-27 11:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-22 15:07 [ath6kl:pending 10/12] drivers/net/wireless/ath/ath10k/mac.c:3010 ath10k_mac_set_sar_specs() warn: this array is probably non-NULL. 'sar->sub_specs' Dan Carpenter
2021-01-27 10:52 ` Kalle Valo
2021-01-27 10:58   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).