netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "pankj.sharma" <pankj.sharma@samsung.com>
To: "'Jeroen Hofstee'" <jhofstee@victronenergy.com>,
	"'Simon Horman'" <simon.horman@netronome.com>
Cc: "'kbuild test robot'" <lkp@intel.com>, <kbuild-all@lists.01.org>,
	<linux-can@vger.kernel.org>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <wg@grandegger.com>,
	<mkl@pengutronix.de>, <davem@davemloft.net>,
	<eugen.hristev@microchip.com>, <ludovic.desroches@microchip.com>,
	<pankaj.dubey@samsung.com>, <rcsekar@samsung.com>,
	"'Sriram Dash'" <sriram.dash@samsung.com>
Subject: RE: [PATCH] can: m_can: fix boolreturn.cocci warnings
Date: Thu, 17 Oct 2019 17:24:41 +0530	[thread overview]
Message-ID: <000f01d584e1$ab1907b0$014b1710$@samsung.com> (raw)
In-Reply-To: <1921cfe4-0ee0-e2a5-6696-df5f612c6c56@victronenergy.com>

> From: Jeroen Hofstee <jhofstee@victronenergy.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@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;

Thank you. Will Modify in v2.

> >> }
> > Good point, silly me.
> 
> 
> For clarity, I am commenting on the suggestion made by the tool, not the patch
> itself..
> 
> Regards,
> 
> Jeroen



  reply	other threads:[~2019-10-17 11:54 UTC|newest]

Thread overview: 12+ 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-14 13: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-15  5:57     ` Simon Horman
2019-10-15  6:37       ` Jeroen Hofstee
2019-10-15  7:13         ` Simon Horman
2019-10-15  8:32           ` Jeroen Hofstee
2019-10-17 11:54             ` pankj.sharma [this message]
2019-10-14 16:20   ` [PATCH] can: m_can: add support for handling arbitration error 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='000f01d584e1$ab1907b0$014b1710$@samsung.com' \
    --to=pankj.sharma@samsung.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=rcsekar@samsung.com \
    --cc=simon.horman@netronome.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 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).