All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@netronome.com>
To: Jeroen Hofstee <jhofstee@victronenergy.com>
Cc: kbuild test robot <lkp@intel.com>,
	Pankaj Sharma <pankj.sharma@samsung.com>,
	"kbuild-all@lists.01.org" <kbuild-all@lists.01.org>,
	"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"wg@grandegger.com" <wg@grandegger.com>,
	"mkl@pengutronix.de" <mkl@pengutronix.de>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"eugen.hristev@microchip.com" <eugen.hristev@microchip.com>,
	"ludovic.desroches@microchip.com"
	<ludovic.desroches@microchip.com>,
	"pankaj.dubey@samsung.com" <pankaj.dubey@samsung.com>,
	"rcsekar@samsung.com" <rcsekar@samsung.com>,
	Sriram Dash <sriram.dash@samsung.com>
Subject: Re: [PATCH] can: m_can: fix boolreturn.cocci warnings
Date: Tue, 15 Oct 2019 09:13:12 +0200	[thread overview]
Message-ID: <20191015071311.yssgqhoax46lfa7l@netronome.com> (raw)
In-Reply-To: <9ad7810b-2205-3227-7ef9-0272f3714839@victronenergy.com>

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@intel.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@samsung.com>
> >> Signed-off-by: kbuild test robot <lkp@intel.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.

WARNING: multiple messages have this Message-ID (diff)
From: Simon Horman <simon.horman@netronome.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH] can: m_can: fix boolreturn.cocci warnings
Date: Tue, 15 Oct 2019 09:13:12 +0200	[thread overview]
Message-ID: <20191015071311.yssgqhoax46lfa7l@netronome.com> (raw)
In-Reply-To: <9ad7810b-2205-3227-7ef9-0272f3714839@victronenergy.com>

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

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@intel.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@samsung.com>
> >> Signed-off-by: kbuild test robot <lkp@intel.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.

  reply	other threads:[~2019-10-15  7:13 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20191014113437epcas5p2143d7e85d5a50dad79a4a60a9d666fe4@epcas5p2.samsung.com>
2019-10-14 11:34 ` [PATCH] can: m_can: add support for handling arbitration error Pankaj Sharma
2019-10-14 12:31   ` Marc Kleine-Budde
2019-10-17 11:51     ` pankj.sharma
2019-10-17 11:51       ` pankj.sharma
2019-10-14 13:04   ` kbuild test robot
2019-10-14 13:04     ` kbuild test robot
2019-10-14 13:04     ` kbuild test robot
2019-10-14 15:04   ` kbuild test robot
2019-10-14 15:04     ` kbuild test robot
2019-10-14 15:04     ` kbuild test robot
2019-10-14 15:04   ` [PATCH] can: m_can: fix boolreturn.cocci warnings kbuild test robot
2019-10-14 15:04     ` kbuild test robot
2019-10-14 15:04     ` kbuild test robot
2019-10-15  5:57     ` Simon Horman
2019-10-15  5:57       ` Simon Horman
2019-10-15  6:37       ` Jeroen Hofstee
2019-10-15  7:13         ` Simon Horman [this message]
2019-10-15  7:13           ` Simon Horman
2019-10-15  8:32           ` Jeroen Hofstee
2019-10-17 11:54             ` pankj.sharma
2019-10-17 11:54               ` pankj.sharma
2019-10-17 11:54               ` pankj.sharma
2019-10-14 16:20   ` [PATCH] can: m_can: add support for handling arbitration error kbuild test robot
2019-10-14 16:20     ` kbuild test robot
2019-10-14 16:20     ` kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191015071311.yssgqhoax46lfa7l@netronome.com \
    --to=simon.horman@netronome.com \
    --cc=davem@davemloft.net \
    --cc=eugen.hristev@microchip.com \
    --cc=jhofstee@victronenergy.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=ludovic.desroches@microchip.com \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=pankaj.dubey@samsung.com \
    --cc=pankj.sharma@samsung.com \
    --cc=rcsekar@samsung.com \
    --cc=sriram.dash@samsung.com \
    --cc=wg@grandegger.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.