All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/net/wireless/ath/ath10k/sdio.c:2234:2: warning: Non-boolean value returned from function returning bool
@ 2020-11-14 18:33 kernel test robot
  0 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2020-11-14 18:33 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Wen Gong <wgong@codeaurora.org>
CC: Kalle Valo <kvalo@codeaurora.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   f01c30de86f1047e9bae1b1b1417b0ce8dcd15b1
commit: 3c45f21af84eb05a355919abc80cf70a3a681cee ath10k: sdio: add firmware coredump support
date:   3 months ago
:::::: branch date: 18 hours ago
:::::: commit date: 3 months ago
compiler: nios2-linux-gcc (GCC) 9.3.0

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


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> drivers/net/wireless/ath/ath9k/ar5008_phy.c:0:0: warning: Invalid value: 0xFF000000_S [cppcheckError]
   
   ^
   drivers/net/wireless/ath/ath9k/ar5008_phy.c:0:0: note: Invalid value: 0xFF000000_S
   
   ^
   drivers/net/wireless/ath/ath9k/ar5008_phy.c:0:0: note: Invalid value: 0xFF000000_S
   
   ^
>> drivers/net/wireless/ath/wcn36xx/smd.c:750:9: warning: Identical condition 'ret', second condition is always false [identicalConditionAfterEarlyExit]
    return ret;
           ^
   drivers/net/wireless/ath/wcn36xx/smd.c:745:6: note: first condition
    if (ret)
        ^
   drivers/net/wireless/ath/wcn36xx/smd.c:750:9: note: second condition
    return ret;
           ^
   drivers/net/wireless/ath/wcn36xx/smd.c:807:9: warning: Identical condition 'ret', second condition is always false [identicalConditionAfterEarlyExit]
    return ret;
           ^
   drivers/net/wireless/ath/wcn36xx/smd.c:791:6: note: first condition
    if (ret)
        ^
   drivers/net/wireless/ath/wcn36xx/smd.c:807:9: note: second condition
    return ret;
           ^
>> drivers/net/wireless/ath/wcn36xx/smd.c:657:2: warning: Redundant pointer operation on 'msg_body' - it's already a pointer. [redundantPointerOp]
    INIT_HAL_MSG((*msg_body), WCN36XX_HAL_START_SCAN_OFFLOAD_REQ);
    ^
   drivers/net/wireless/ath/wcn36xx/smd.c:688:2: warning: Redundant pointer operation on 'msg_body' - it's already a pointer. [redundantPointerOp]
    PREPARE_HAL_BUF(wcn->hal_buf, (*msg_body));
    ^
   drivers/net/wireless/ath/wcn36xx/smd.c:1276:2: warning: Redundant pointer operation on 'msg_body' - it's already a pointer. [redundantPointerOp]
    INIT_HAL_MSG((*msg_body), WCN36XX_HAL_CONFIG_BSS_REQ);
    ^
   drivers/net/wireless/ath/wcn36xx/smd.c:1364:2: warning: Redundant pointer operation on 'msg_body' - it's already a pointer. [redundantPointerOp]
    PREPARE_HAL_BUF(wcn->hal_buf, (*msg_body));
    ^
>> drivers/net/wireless/ath/wcn36xx/smd.c:1443:2: warning: Redundant pointer operation on 'msg' - it's already a pointer. [redundantPointerOp]
    INIT_HAL_MSG((*msg), WCN36XX_HAL_CONFIG_BSS_REQ);
    ^
   drivers/net/wireless/ath/wcn36xx/smd.c:1542:3: warning: Redundant pointer operation on 'msg' - it's already a pointer. [redundantPointerOp]
     PREPARE_HAL_BUF(wcn->hal_buf, (*msg));
     ^
>> drivers/net/wireless/ath/ath10k/sdio.c:2234:2: warning: Non-boolean value returned from function returning bool [returnNonBoolInBooleanFunction]
    return param & HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW;
    ^

vim +2234 drivers/net/wireless/ath/ath10k/sdio.c

3c45f21af84eb05 Wen Gong 2020-08-18  2225  
3c45f21af84eb05 Wen Gong 2020-08-18  2226  static bool ath10k_sdio_is_fast_dump_supported(struct ath10k *ar)
3c45f21af84eb05 Wen Gong 2020-08-18  2227  {
3c45f21af84eb05 Wen Gong 2020-08-18  2228  	u32 param;
3c45f21af84eb05 Wen Gong 2020-08-18  2229  
3c45f21af84eb05 Wen Gong 2020-08-18  2230  	ath10k_sdio_read_host_interest_value(ar, HI_ITEM(hi_option_flag2), &param);
3c45f21af84eb05 Wen Gong 2020-08-18  2231  
3c45f21af84eb05 Wen Gong 2020-08-18  2232  	ath10k_dbg(ar, ATH10K_DBG_SDIO, "sdio hi_option_flag2 %x\n", param);
3c45f21af84eb05 Wen Gong 2020-08-18  2233  
3c45f21af84eb05 Wen Gong 2020-08-18 @2234  	return param & HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW;
3c45f21af84eb05 Wen Gong 2020-08-18  2235  }
3c45f21af84eb05 Wen Gong 2020-08-18  2236  

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

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

* drivers/net/wireless/ath/ath10k/sdio.c:2234:2: warning: Non-boolean value returned from function returning bool
@ 2020-11-16  5:53 ` kernel test robot
  0 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2020-11-16  5:53 UTC (permalink / raw)
  To: kbuild-all

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   f01c30de86f1047e9bae1b1b1417b0ce8dcd15b1
commit: 3c45f21af84eb05a355919abc80cf70a3a681cee ath10k: sdio: add firmware coredump support
compiler: nios2-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <rong.a.chen@intel.com>


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> drivers/net/wireless/ath/ath10k/sdio.c:2234:2: warning: Non-boolean value returned from function returning bool [returnNonBoolInBooleanFunction]
    return param & HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW;
    ^

vim +2234 drivers/net/wireless/ath/ath10k/sdio.c

3c45f21af84eb05 Wen Gong 2020-08-18  2225  
3c45f21af84eb05 Wen Gong 2020-08-18  2226  static bool ath10k_sdio_is_fast_dump_supported(struct ath10k *ar)
3c45f21af84eb05 Wen Gong 2020-08-18  2227  {
3c45f21af84eb05 Wen Gong 2020-08-18  2228  	u32 param;
3c45f21af84eb05 Wen Gong 2020-08-18  2229  
3c45f21af84eb05 Wen Gong 2020-08-18  2230  	ath10k_sdio_read_host_interest_value(ar, HI_ITEM(hi_option_flag2), &param);
3c45f21af84eb05 Wen Gong 2020-08-18  2231  
3c45f21af84eb05 Wen Gong 2020-08-18  2232  	ath10k_dbg(ar, ATH10K_DBG_SDIO, "sdio hi_option_flag2 %x\n", param);
3c45f21af84eb05 Wen Gong 2020-08-18  2233  
3c45f21af84eb05 Wen Gong 2020-08-18 @2234  	return param & HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW;
3c45f21af84eb05 Wen Gong 2020-08-18  2235  }
3c45f21af84eb05 Wen Gong 2020-08-18  2236  

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

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

* drivers/net/wireless/ath/ath10k/sdio.c:2234:2: warning: Non-boolean value returned from function returning bool
@ 2020-11-16  5:53 ` kernel test robot
  0 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2020-11-16  5:53 UTC (permalink / raw)
  To: Wen Gong; +Cc: kbuild-all, linux-kernel, Kalle Valo

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   f01c30de86f1047e9bae1b1b1417b0ce8dcd15b1
commit: 3c45f21af84eb05a355919abc80cf70a3a681cee ath10k: sdio: add firmware coredump support
compiler: nios2-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <rong.a.chen@intel.com>


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> drivers/net/wireless/ath/ath10k/sdio.c:2234:2: warning: Non-boolean value returned from function returning bool [returnNonBoolInBooleanFunction]
    return param & HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW;
    ^

vim +2234 drivers/net/wireless/ath/ath10k/sdio.c

3c45f21af84eb05 Wen Gong 2020-08-18  2225  
3c45f21af84eb05 Wen Gong 2020-08-18  2226  static bool ath10k_sdio_is_fast_dump_supported(struct ath10k *ar)
3c45f21af84eb05 Wen Gong 2020-08-18  2227  {
3c45f21af84eb05 Wen Gong 2020-08-18  2228  	u32 param;
3c45f21af84eb05 Wen Gong 2020-08-18  2229  
3c45f21af84eb05 Wen Gong 2020-08-18  2230  	ath10k_sdio_read_host_interest_value(ar, HI_ITEM(hi_option_flag2), &param);
3c45f21af84eb05 Wen Gong 2020-08-18  2231  
3c45f21af84eb05 Wen Gong 2020-08-18  2232  	ath10k_dbg(ar, ATH10K_DBG_SDIO, "sdio hi_option_flag2 %x\n", param);
3c45f21af84eb05 Wen Gong 2020-08-18  2233  
3c45f21af84eb05 Wen Gong 2020-08-18 @2234  	return param & HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW;
3c45f21af84eb05 Wen Gong 2020-08-18  2235  }
3c45f21af84eb05 Wen Gong 2020-08-18  2236  

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

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

* Re: drivers/net/wireless/ath/ath10k/sdio.c:2234:2: warning: Non-boolean value returned from function returning bool
  2020-11-16  5:53 ` kernel test robot
  (?)
@ 2020-11-16  7:53   ` Kalle Valo
  -1 siblings, 0 replies; 9+ messages in thread
From: Kalle Valo @ 2020-11-16  7:53 UTC (permalink / raw)
  To: kernel test robot; +Cc: kbuild-all, linux-kernel, ath10k, Wen Gong

+ ath10k list

kernel test robot <rong.a.chen@intel.com> writes:

> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   f01c30de86f1047e9bae1b1b1417b0ce8dcd15b1
> commit: 3c45f21af84eb05a355919abc80cf70a3a681cee ath10k: sdio: add
> firmware coredump support
> compiler: nios2-linux-gcc (GCC) 9.3.0
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <rong.a.chen@intel.com>
>
>
> cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>
>>> drivers/net/wireless/ath/ath10k/sdio.c:2234:2: warning: Non-boolean
> value returned from function returning bool
> [returnNonBoolInBooleanFunction]
>     return param & HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW;
>     ^

Is this really a problem? I guess we could change that to "!!(param &
HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW)" but how is that better and
does it make any practical difference when
ath10k_sdio_is_fast_dump_supported() returns a boolean anyway?

-- 
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] 9+ messages in thread

* Re: drivers/net/wireless/ath/ath10k/sdio.c:2234:2: warning: Non-boolean value returned from function returning bool
@ 2020-11-16  7:53   ` Kalle Valo
  0 siblings, 0 replies; 9+ messages in thread
From: Kalle Valo @ 2020-11-16  7:53 UTC (permalink / raw)
  To: kbuild-all

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

+ ath10k list

kernel test robot <rong.a.chen@intel.com> writes:

> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   f01c30de86f1047e9bae1b1b1417b0ce8dcd15b1
> commit: 3c45f21af84eb05a355919abc80cf70a3a681cee ath10k: sdio: add
> firmware coredump support
> compiler: nios2-linux-gcc (GCC) 9.3.0
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <rong.a.chen@intel.com>
>
>
> cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>
>>> drivers/net/wireless/ath/ath10k/sdio.c:2234:2: warning: Non-boolean
> value returned from function returning bool
> [returnNonBoolInBooleanFunction]
>     return param & HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW;
>     ^

Is this really a problem? I guess we could change that to "!!(param &
HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW)" but how is that better and
does it make any practical difference when
ath10k_sdio_is_fast_dump_supported() returns a boolean anyway?

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

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

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

* Re: drivers/net/wireless/ath/ath10k/sdio.c:2234:2: warning: Non-boolean value returned from function returning bool
@ 2020-11-16  7:53   ` Kalle Valo
  0 siblings, 0 replies; 9+ messages in thread
From: Kalle Valo @ 2020-11-16  7:53 UTC (permalink / raw)
  To: kernel test robot; +Cc: Wen Gong, kbuild-all, linux-kernel, ath10k

+ ath10k list

kernel test robot <rong.a.chen@intel.com> writes:

> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   f01c30de86f1047e9bae1b1b1417b0ce8dcd15b1
> commit: 3c45f21af84eb05a355919abc80cf70a3a681cee ath10k: sdio: add
> firmware coredump support
> compiler: nios2-linux-gcc (GCC) 9.3.0
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <rong.a.chen@intel.com>
>
>
> cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>
>>> drivers/net/wireless/ath/ath10k/sdio.c:2234:2: warning: Non-boolean
> value returned from function returning bool
> [returnNonBoolInBooleanFunction]
>     return param & HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW;
>     ^

Is this really a problem? I guess we could change that to "!!(param &
HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW)" but how is that better and
does it make any practical difference when
ath10k_sdio_is_fast_dump_supported() returns a boolean anyway?

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

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

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

* Re: drivers/net/wireless/ath/ath10k/sdio.c:2234:2: warning: Non-boolean value returned from function returning bool
  2020-11-16  7:53   ` Kalle Valo
  (?)
@ 2020-11-16  9:33     ` Wen Gong
  -1 siblings, 0 replies; 9+ messages in thread
From: Wen Gong @ 2020-11-16  9:33 UTC (permalink / raw)
  To: Kalle Valo; +Cc: kbuild-all, linux-kernel, ath10k, kernel test robot

On 2020-11-16 15:53, Kalle Valo wrote:
> + ath10k list
> 
> kernel test robot <rong.a.chen@intel.com> writes:
> 
>> tree:   
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
>> master
>> head:   f01c30de86f1047e9bae1b1b1417b0ce8dcd15b1
>> commit: 3c45f21af84eb05a355919abc80cf70a3a681cee ath10k: sdio: add
>> firmware coredump support
>> compiler: nios2-linux-gcc (GCC) 9.3.0
>> 
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <rong.a.chen@intel.com>
>> 
>> 
>> cppcheck possible warnings: (new ones prefixed by >>, may not real 
>> problems)
>> 
>>>> drivers/net/wireless/ath/ath10k/sdio.c:2234:2: warning: Non-boolean
>> value returned from function returning bool
>> [returnNonBoolInBooleanFunction]
>>     return param & HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW;
>>     ^
> 
> Is this really a problem? I guess we could change that to "!!(param &
> HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW)" but how is that better and
> does it make any practical difference when
> ath10k_sdio_is_fast_dump_supported() returns a boolean anyway?
It should not be a real problem by test before.
ath10k_sdio_is_fast_dump_supported return true in test before.
and fast_dump get true from ath10k_sdio_is_fast_dump_supported in 
ath10k_sdio_fw_crashed_dump.

the risk maybe like this:
u32 param in ath10k_sdio_is_fast_dump_supported is 4 bytes, and bool is 
1 byte.
if Gcc does not do any convertion from u32 to bool, then the bool value 
will only
get the lower byte(byte 0) of the 4 bytes, then maybe get an mistake 
result.

I did a disassemble of sdio.o with/without below change, and dump 
sdio.o, it have no difference in this place:
I change send a patch with below change if needed.
@@ -2231,7 +2231,7 @@ static bool 
ath10k_sdio_is_fast_dump_supported(struct ath10k *ar)

         ath10k_dbg(ar, ATH10K_DBG_SDIO, "sdio hi_option_flag2 %x\n", 
param);

-       return param & HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW;
+       return !!(param & HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW);
  }

objdump -Sl sdio.o > sdio.o-Sl.txt

0000000000002b00 <ath10k_sdio_fw_crashed_dump>:
void ath10k_sdio_fw_crashed_dump(struct ath10k *ar)
{
...
/home/wgong/ath11k/ath-master/ath/drivers/net/wireless/ath/ath10k/sdio.c:2234

	return param & HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW;
     2b75:	8b 44 24 44          	mov    0x44(%rsp),%eax
     2b79:	25 00 08 00 00       	and    $0x800,%eax //"the SF, ZF, and PF 
flags are set according to the result".ZF will be 0 if true.
     2b7e:	89 44 24 2c          	mov    %eax,0x2c(%rsp)
     2b82:	40 0f 95 c5          	setne  %bpl //"Set byte if not equal 
(ZF=0)".stored the ZF flag to bpl as value of fast_dump.
ath10k_sdio_fw_crashed_dump():
/home/wgong/ath11k/ath-master/ath/drivers/net/wireless/ath/ath10k/sdio.c:2483
	char guid[UUID_STRING_LEN + 1];
	bool fast_dump;

	fast_dump = ath10k_sdio_is_fast_dump_supported(ar);

	if (fast_dump)
     2b86:	0f 85 c3 03 00 00    	jne    2f4f 
<ath10k_sdio_fw_crashed_dump+0x44f> //"Jump near if not equal (ZF=0)"
...
/home/wgong/ath11k/ath-master/ath/drivers/net/wireless/ath/ath10k/sdio.c:2499
	ath10k_sdio_dump_registers(ar, crash_data, fast_dump);
     2be5:	40 0f b6 d5          	movzbl %bpl,%edx //use the bpl stored as 
value of fast_dump
     2be9:	48 89 de             	mov    %rbx,%rsi
     2bec:	4c 89 ff             	mov    %r15,%rdi
     2bef:	e8 8c fb ff ff       	callq  2780 <ath10k_sdio_dump_registers>


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

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

* Re: drivers/net/wireless/ath/ath10k/sdio.c:2234:2: warning: Non-boolean value returned from function returning bool
@ 2020-11-16  9:33     ` Wen Gong
  0 siblings, 0 replies; 9+ messages in thread
From: Wen Gong @ 2020-11-16  9:33 UTC (permalink / raw)
  To: kbuild-all

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

On 2020-11-16 15:53, Kalle Valo wrote:
> + ath10k list
> 
> kernel test robot <rong.a.chen@intel.com> writes:
> 
>> tree:   
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
>> master
>> head:   f01c30de86f1047e9bae1b1b1417b0ce8dcd15b1
>> commit: 3c45f21af84eb05a355919abc80cf70a3a681cee ath10k: sdio: add
>> firmware coredump support
>> compiler: nios2-linux-gcc (GCC) 9.3.0
>> 
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <rong.a.chen@intel.com>
>> 
>> 
>> cppcheck possible warnings: (new ones prefixed by >>, may not real 
>> problems)
>> 
>>>> drivers/net/wireless/ath/ath10k/sdio.c:2234:2: warning: Non-boolean
>> value returned from function returning bool
>> [returnNonBoolInBooleanFunction]
>>     return param & HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW;
>>     ^
> 
> Is this really a problem? I guess we could change that to "!!(param &
> HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW)" but how is that better and
> does it make any practical difference when
> ath10k_sdio_is_fast_dump_supported() returns a boolean anyway?
It should not be a real problem by test before.
ath10k_sdio_is_fast_dump_supported return true in test before.
and fast_dump get true from ath10k_sdio_is_fast_dump_supported in 
ath10k_sdio_fw_crashed_dump.

the risk maybe like this:
u32 param in ath10k_sdio_is_fast_dump_supported is 4 bytes, and bool is 
1 byte.
if Gcc does not do any convertion from u32 to bool, then the bool value 
will only
get the lower byte(byte 0) of the 4 bytes, then maybe get an mistake 
result.

I did a disassemble of sdio.o with/without below change, and dump 
sdio.o, it have no difference in this place:
I change send a patch with below change if needed.
@@ -2231,7 +2231,7 @@ static bool 
ath10k_sdio_is_fast_dump_supported(struct ath10k *ar)

         ath10k_dbg(ar, ATH10K_DBG_SDIO, "sdio hi_option_flag2 %x\n", 
param);

-       return param & HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW;
+       return !!(param & HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW);
  }

objdump -Sl sdio.o > sdio.o-Sl.txt

0000000000002b00 <ath10k_sdio_fw_crashed_dump>:
void ath10k_sdio_fw_crashed_dump(struct ath10k *ar)
{
...
/home/wgong/ath11k/ath-master/ath/drivers/net/wireless/ath/ath10k/sdio.c:2234

	return param & HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW;
     2b75:	8b 44 24 44          	mov    0x44(%rsp),%eax
     2b79:	25 00 08 00 00       	and    $0x800,%eax //"the SF, ZF, and PF 
flags are set according to the result".ZF will be 0 if true.
     2b7e:	89 44 24 2c          	mov    %eax,0x2c(%rsp)
     2b82:	40 0f 95 c5          	setne  %bpl //"Set byte if not equal 
(ZF=0)".stored the ZF flag to bpl as value of fast_dump.
ath10k_sdio_fw_crashed_dump():
/home/wgong/ath11k/ath-master/ath/drivers/net/wireless/ath/ath10k/sdio.c:2483
	char guid[UUID_STRING_LEN + 1];
	bool fast_dump;

	fast_dump = ath10k_sdio_is_fast_dump_supported(ar);

	if (fast_dump)
     2b86:	0f 85 c3 03 00 00    	jne    2f4f 
<ath10k_sdio_fw_crashed_dump+0x44f> //"Jump near if not equal (ZF=0)"
...
/home/wgong/ath11k/ath-master/ath/drivers/net/wireless/ath/ath10k/sdio.c:2499
	ath10k_sdio_dump_registers(ar, crash_data, fast_dump);
     2be5:	40 0f b6 d5          	movzbl %bpl,%edx //use the bpl stored as 
value of fast_dump
     2be9:	48 89 de             	mov    %rbx,%rsi
     2bec:	4c 89 ff             	mov    %r15,%rdi
     2bef:	e8 8c fb ff ff       	callq  2780 <ath10k_sdio_dump_registers>

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

* Re: drivers/net/wireless/ath/ath10k/sdio.c:2234:2: warning: Non-boolean value returned from function returning bool
@ 2020-11-16  9:33     ` Wen Gong
  0 siblings, 0 replies; 9+ messages in thread
From: Wen Gong @ 2020-11-16  9:33 UTC (permalink / raw)
  To: Kalle Valo; +Cc: kernel test robot, kbuild-all, linux-kernel, ath10k

On 2020-11-16 15:53, Kalle Valo wrote:
> + ath10k list
> 
> kernel test robot <rong.a.chen@intel.com> writes:
> 
>> tree:   
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
>> master
>> head:   f01c30de86f1047e9bae1b1b1417b0ce8dcd15b1
>> commit: 3c45f21af84eb05a355919abc80cf70a3a681cee ath10k: sdio: add
>> firmware coredump support
>> compiler: nios2-linux-gcc (GCC) 9.3.0
>> 
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <rong.a.chen@intel.com>
>> 
>> 
>> cppcheck possible warnings: (new ones prefixed by >>, may not real 
>> problems)
>> 
>>>> drivers/net/wireless/ath/ath10k/sdio.c:2234:2: warning: Non-boolean
>> value returned from function returning bool
>> [returnNonBoolInBooleanFunction]
>>     return param & HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW;
>>     ^
> 
> Is this really a problem? I guess we could change that to "!!(param &
> HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW)" but how is that better and
> does it make any practical difference when
> ath10k_sdio_is_fast_dump_supported() returns a boolean anyway?
It should not be a real problem by test before.
ath10k_sdio_is_fast_dump_supported return true in test before.
and fast_dump get true from ath10k_sdio_is_fast_dump_supported in 
ath10k_sdio_fw_crashed_dump.

the risk maybe like this:
u32 param in ath10k_sdio_is_fast_dump_supported is 4 bytes, and bool is 
1 byte.
if Gcc does not do any convertion from u32 to bool, then the bool value 
will only
get the lower byte(byte 0) of the 4 bytes, then maybe get an mistake 
result.

I did a disassemble of sdio.o with/without below change, and dump 
sdio.o, it have no difference in this place:
I change send a patch with below change if needed.
@@ -2231,7 +2231,7 @@ static bool 
ath10k_sdio_is_fast_dump_supported(struct ath10k *ar)

         ath10k_dbg(ar, ATH10K_DBG_SDIO, "sdio hi_option_flag2 %x\n", 
param);

-       return param & HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW;
+       return !!(param & HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW);
  }

objdump -Sl sdio.o > sdio.o-Sl.txt

0000000000002b00 <ath10k_sdio_fw_crashed_dump>:
void ath10k_sdio_fw_crashed_dump(struct ath10k *ar)
{
...
/home/wgong/ath11k/ath-master/ath/drivers/net/wireless/ath/ath10k/sdio.c:2234

	return param & HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_FW;
     2b75:	8b 44 24 44          	mov    0x44(%rsp),%eax
     2b79:	25 00 08 00 00       	and    $0x800,%eax //"the SF, ZF, and PF 
flags are set according to the result".ZF will be 0 if true.
     2b7e:	89 44 24 2c          	mov    %eax,0x2c(%rsp)
     2b82:	40 0f 95 c5          	setne  %bpl //"Set byte if not equal 
(ZF=0)".stored the ZF flag to bpl as value of fast_dump.
ath10k_sdio_fw_crashed_dump():
/home/wgong/ath11k/ath-master/ath/drivers/net/wireless/ath/ath10k/sdio.c:2483
	char guid[UUID_STRING_LEN + 1];
	bool fast_dump;

	fast_dump = ath10k_sdio_is_fast_dump_supported(ar);

	if (fast_dump)
     2b86:	0f 85 c3 03 00 00    	jne    2f4f 
<ath10k_sdio_fw_crashed_dump+0x44f> //"Jump near if not equal (ZF=0)"
...
/home/wgong/ath11k/ath-master/ath/drivers/net/wireless/ath/ath10k/sdio.c:2499
	ath10k_sdio_dump_registers(ar, crash_data, fast_dump);
     2be5:	40 0f b6 d5          	movzbl %bpl,%edx //use the bpl stored as 
value of fast_dump
     2be9:	48 89 de             	mov    %rbx,%rsi
     2bec:	4c 89 ff             	mov    %r15,%rdi
     2bef:	e8 8c fb ff ff       	callq  2780 <ath10k_sdio_dump_registers>


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

end of thread, other threads:[~2020-11-16 10:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-16  5:53 drivers/net/wireless/ath/ath10k/sdio.c:2234:2: warning: Non-boolean value returned from function returning bool kernel test robot
2020-11-16  5:53 ` kernel test robot
2020-11-16  7:53 ` Kalle Valo
2020-11-16  7:53   ` Kalle Valo
2020-11-16  7:53   ` Kalle Valo
2020-11-16  9:33   ` Wen Gong
2020-11-16  9:33     ` Wen Gong
2020-11-16  9:33     ` Wen Gong
  -- strict thread matches above, loose matches on Subject: below --
2020-11-14 18:33 kernel test robot

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.