netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtw88: fix fw_fifo_addr check
@ 2020-10-11 15:54 trix
  2020-10-12  2:24 ` Nathan Chancellor
  2020-11-02 18:16 ` Kalle Valo
  0 siblings, 2 replies; 4+ messages in thread
From: trix @ 2020-10-11 15:54 UTC (permalink / raw)
  To: yhchuang, kvalo, davem, kuba, natechancellor, ndesaulniers
  Cc: linux-wireless, netdev, linux-kernel, clang-built-linux, Tom Rix

From: Tom Rix <trix@redhat.com>

The clang build reports this warning

fw.c:1485:21: warning: address of array 'rtwdev->chip->fw_fifo_addr'
  will always evaluate to 'true'
        if (!rtwdev->chip->fw_fifo_addr) {

fw_fifo_addr is an array in rtw_chip_info so it is always
nonzero.  A better check is if the first element of the array is
nonzero.  In the cases where fw_fifo_addr is initialized by rtw88b
and rtw88c, the first array element is 0x780.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/net/wireless/realtek/rtw88/fw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtw88/fw.c b/drivers/net/wireless/realtek/rtw88/fw.c
index 042015bc8055..b2fd87834f23 100644
--- a/drivers/net/wireless/realtek/rtw88/fw.c
+++ b/drivers/net/wireless/realtek/rtw88/fw.c
@@ -1482,7 +1482,7 @@ static bool rtw_fw_dump_check_size(struct rtw_dev *rtwdev,
 int rtw_fw_dump_fifo(struct rtw_dev *rtwdev, u8 fifo_sel, u32 addr, u32 size,
 		     u32 *buffer)
 {
-	if (!rtwdev->chip->fw_fifo_addr) {
+	if (!rtwdev->chip->fw_fifo_addr[0]) {
 		rtw_dbg(rtwdev, RTW_DBG_FW, "chip not support dump fw fifo\n");
 		return -ENOTSUPP;
 	}
-- 
2.18.1


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

* Re: [PATCH] rtw88: fix fw_fifo_addr check
  2020-10-11 15:54 [PATCH] rtw88: fix fw_fifo_addr check trix
@ 2020-10-12  2:24 ` Nathan Chancellor
  2020-10-14  2:21   ` Andy Huang
  2020-11-02 18:16 ` Kalle Valo
  1 sibling, 1 reply; 4+ messages in thread
From: Nathan Chancellor @ 2020-10-12  2:24 UTC (permalink / raw)
  To: trix
  Cc: yhchuang, kvalo, davem, kuba, ndesaulniers, linux-wireless,
	netdev, linux-kernel, clang-built-linux

On Sun, Oct 11, 2020 at 08:54:38AM -0700, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
> 
> The clang build reports this warning
> 
> fw.c:1485:21: warning: address of array 'rtwdev->chip->fw_fifo_addr'
>   will always evaluate to 'true'
>         if (!rtwdev->chip->fw_fifo_addr) {
> 
> fw_fifo_addr is an array in rtw_chip_info so it is always
> nonzero.  A better check is if the first element of the array is
> nonzero.  In the cases where fw_fifo_addr is initialized by rtw88b
> and rtw88c, the first array element is 0x780.
> 
> Signed-off-by: Tom Rix <trix@redhat.com>

Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>

> ---
>  drivers/net/wireless/realtek/rtw88/fw.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtw88/fw.c b/drivers/net/wireless/realtek/rtw88/fw.c
> index 042015bc8055..b2fd87834f23 100644
> --- a/drivers/net/wireless/realtek/rtw88/fw.c
> +++ b/drivers/net/wireless/realtek/rtw88/fw.c
> @@ -1482,7 +1482,7 @@ static bool rtw_fw_dump_check_size(struct rtw_dev *rtwdev,
>  int rtw_fw_dump_fifo(struct rtw_dev *rtwdev, u8 fifo_sel, u32 addr, u32 size,
>  		     u32 *buffer)
>  {
> -	if (!rtwdev->chip->fw_fifo_addr) {
> +	if (!rtwdev->chip->fw_fifo_addr[0]) {
>  		rtw_dbg(rtwdev, RTW_DBG_FW, "chip not support dump fw fifo\n");
>  		return -ENOTSUPP;
>  	}
> -- 
> 2.18.1
> 

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

* RE: [PATCH] rtw88: fix fw_fifo_addr check
  2020-10-12  2:24 ` Nathan Chancellor
@ 2020-10-14  2:21   ` Andy Huang
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Huang @ 2020-10-14  2:21 UTC (permalink / raw)
  To: 'Nathan Chancellor', trix
  Cc: Tony Chuang, kvalo, davem, kuba, ndesaulniers, linux-wireless,
	netdev, linux-kernel, clang-built-linux


> On Sun, Oct 11, 2020 at 08:54:38AM -0700, trix@redhat.com wrote:
> > From: Tom Rix <trix@redhat.com>
> >
> > The clang build reports this warning
> >
> > fw.c:1485:21: warning: address of array 'rtwdev->chip->fw_fifo_addr'
> >   will always evaluate to 'true'
> >         if (!rtwdev->chip->fw_fifo_addr) {
> >
> > fw_fifo_addr is an array in rtw_chip_info so it is always nonzero.  A
> > better check is if the first element of the array is nonzero.  In the
> > cases where fw_fifo_addr is initialized by rtw88b and rtw88c, the
> > first array element is 0x780.
> >
> > Signed-off-by: Tom Rix <trix@redhat.com>
> 
> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
> 

Thanks for your fix,

Acked-by: Tzu-En Huang <tehuang@realtek.com>

> > ---
> >  drivers/net/wireless/realtek/rtw88/fw.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/wireless/realtek/rtw88/fw.c
> > b/drivers/net/wireless/realtek/rtw88/fw.c
> > index 042015bc8055..b2fd87834f23 100644
> > --- a/drivers/net/wireless/realtek/rtw88/fw.c
> > +++ b/drivers/net/wireless/realtek/rtw88/fw.c
> > @@ -1482,7 +1482,7 @@ static bool rtw_fw_dump_check_size(struct
> > rtw_dev *rtwdev,  int rtw_fw_dump_fifo(struct rtw_dev *rtwdev, u8
> fifo_sel, u32 addr, u32 size,
> >  		     u32 *buffer)
> >  {
> > -	if (!rtwdev->chip->fw_fifo_addr) {
> > +	if (!rtwdev->chip->fw_fifo_addr[0]) {
> >  		rtw_dbg(rtwdev, RTW_DBG_FW, "chip not support dump fw fifo\n");
> >  		return -ENOTSUPP;
> >  	}
> > --
> > 2.18.1
> >
> 
> ------Please consider the environment before printing this e-mail.

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

* Re: rtw88: fix fw_fifo_addr check
  2020-10-11 15:54 [PATCH] rtw88: fix fw_fifo_addr check trix
  2020-10-12  2:24 ` Nathan Chancellor
@ 2020-11-02 18:16 ` Kalle Valo
  1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2020-11-02 18:16 UTC (permalink / raw)
  To: trix
  Cc: yhchuang, davem, kuba, natechancellor, ndesaulniers,
	linux-wireless, netdev, linux-kernel, clang-built-linux, Tom Rix

trix@redhat.com wrote:

> From: Tom Rix <trix@redhat.com>
> 
> The clang build reports this warning
> 
> fw.c:1485:21: warning: address of array 'rtwdev->chip->fw_fifo_addr'
>   will always evaluate to 'true'
>         if (!rtwdev->chip->fw_fifo_addr) {
> 
> fw_fifo_addr is an array in rtw_chip_info so it is always
> nonzero.  A better check is if the first element of the array is
> nonzero.  In the cases where fw_fifo_addr is initialized by rtw88b
> and rtw88c, the first array element is 0x780.
> 
> Fixes: 0fbc2f0f34cc ("rtw88: add dump firmware fifo support")
> Signed-off-by: Tom Rix <trix@redhat.com>
> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
> Acked-by: Tzu-En Huang <tehuang@realtek.com>

Patch applied to wireless-drivers.git, thanks.

ddcd945e556e rtw88: fix fw_fifo_addr check

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20201011155438.15892-1-trix@redhat.com/

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


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

end of thread, other threads:[~2020-11-02 18:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-11 15:54 [PATCH] rtw88: fix fw_fifo_addr check trix
2020-10-12  2:24 ` Nathan Chancellor
2020-10-14  2:21   ` Andy Huang
2020-11-02 18:16 ` Kalle Valo

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).