[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1921cfe4-0ee0-e2a5-6696-df5f612c6c56@victronenergy.com>
Date: Tue, 15 Oct 2019 08:32:12 +0000
From: Jeroen Hofstee <jhofstee@...tronenergy.com>
To: Simon Horman <simon.horman@...ronome.com>
CC: kbuild test robot <lkp@...el.com>,
Pankaj Sharma <pankj.sharma@...sung.com>,
"kbuild-all@...ts.01.org" <kbuild-all@...ts.01.org>,
"linux-can@...r.kernel.org" <linux-can@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"wg@...ndegger.com" <wg@...ndegger.com>,
"mkl@...gutronix.de" <mkl@...gutronix.de>,
"davem@...emloft.net" <davem@...emloft.net>,
"eugen.hristev@...rochip.com" <eugen.hristev@...rochip.com>,
"ludovic.desroches@...rochip.com" <ludovic.desroches@...rochip.com>,
"pankaj.dubey@...sung.com" <pankaj.dubey@...sung.com>,
"rcsekar@...sung.com" <rcsekar@...sung.com>,
Sriram Dash <sriram.dash@...sung.com>
Subject: Re: [PATCH] can: m_can: fix boolreturn.cocci warnings
Hello Simon,
On 10/15/19 9:13 AM, Simon Horman wrote:
> On Tue, Oct 15, 2019 at 06:37:54AM +0000, Jeroen Hofstee wrote:
>> Hi,
>>
>> On 10/15/19 7:57 AM, Simon Horman wrote:
>>> On Mon, Oct 14, 2019 at 11:04:28PM +0800, kbuild test robot wrote:
>>>> From: kbuild test robot <lkp@...el.com>
>>>>
>>>> drivers/net/can/m_can/m_can.c:783:9-10: WARNING: return of 0/1 in function 'is_protocol_err' with return type bool
>>>>
>>>> Return statements in functions returning bool should use
>>>> true/false instead of 1/0.
>>>> Generated by: scripts/coccinelle/misc/boolreturn.cocci
>>>>
>>>> Fixes: 46946163ac61 ("can: m_can: add support for handling arbitration error")
>>>> CC: Pankaj Sharma <pankj.sharma@...sung.com>
>>>> Signed-off-by: kbuild test robot <lkp@...el.com>
>>>> ---
>>>>
>>>> url: https://github.com/0day-ci/linux/commits/Pankaj-Sharma/can-m_can-add-support-for-handling-arbitration-error/20191014-193532
>>>>
>>>> m_can.c | 4 ++--
>>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> --- a/drivers/net/can/m_can/m_can.c
>>>> +++ b/drivers/net/can/m_can/m_can.c
>>>> @@ -780,9 +780,9 @@ static inline bool is_lec_err(u32 psr)
>>>> static inline bool is_protocol_err(u32 irqstatus)
>>>> {
>>>> if (irqstatus & IR_ERR_LEC_31X)
>>>> - return 1;
>>>> + return true;
>>>> else
>>>> - return 0;
>>>> + return false;
>>>> }
>>>>
>>>> static int m_can_handle_protocol_error(struct net_device *dev, u32 irqstatus)
>>>>
>>> <2c>
>>> Perhaps the following is a nicer way to express this (completely untested):
>>>
>>> return !!(irqstatus & IR_ERR_LEC_31X);
>>> </2c>
>>
>> Really...., !! for bool / _Bool types? why not simply:
>>
>> static inline bool is_protocol_err(u32 irqstatus)
>> return irqstatus & IR_ERR_LEC_31X;
>> }
> Good point, silly me.
For clarity, I am commenting on the suggestion made by
the tool, not the patch itself..
Regards,
Jeroen
Powered by blists - more mailing lists