From: Hans Verkuil <hverkuil@xs4all.nl> To: Nishka Dasgupta <nishkadg.linux@gmail.com>, maxime.ripard@bootlin.com, paul.kocialkowski@bootlin.com, mchehab@kernel.org, gregkh@linuxfoundation.org, wens@csie.org, linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2] staging: media: sunxi: Add bool cast to value Date: Thu, 25 Jul 2019 13:24:23 +0200 [thread overview] Message-ID: <960d6d68-dff0-1774-8173-b5b1dd0d32f3@xs4all.nl> (raw) In-Reply-To: <20190722060651.6538-1-nishkadg.linux@gmail.com> On 7/22/19 8:06 AM, Nishka Dasgupta wrote: > Typecast as bool the return value of cedrus_find_format in > cedrus_check_format as the return value of cedrus_check_format is always > treated like a boolean value. > > Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com> > --- > Changes in v2: > - Add !! to the returned pointer to ensure that the return value is > always either true or false, and never a non-zero value other than > true. > > drivers/staging/media/sunxi/cedrus/cedrus_video.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c > index e2b530b1a956..b731745f21f8 100644 > --- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c > +++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c > @@ -86,7 +86,7 @@ static struct cedrus_format *cedrus_find_format(u32 pixelformat, u32 directions, > static bool cedrus_check_format(u32 pixelformat, u32 directions, > unsigned int capabilities) > { > - return cedrus_find_format(pixelformat, directions, capabilities); > + return !!(bool)cedrus_find_format(pixelformat, directions, capabilities); Why not write: return cedrus_find_format(pixelformat, directions, capabilities) != NULL; That way coccinelle should be happy, and it is clear that cedrus_find_format returns a pointer and that we return true if it is non-NULL. Regards, Hans > } > > static void cedrus_prepare_format(struct v4l2_pix_format *pix_fmt) >
WARNING: multiple messages have this Message-ID (diff)
From: Hans Verkuil <hverkuil@xs4all.nl> To: Nishka Dasgupta <nishkadg.linux@gmail.com>, maxime.ripard@bootlin.com, paul.kocialkowski@bootlin.com, mchehab@kernel.org, gregkh@linuxfoundation.org, wens@csie.org, linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2] staging: media: sunxi: Add bool cast to value Date: Thu, 25 Jul 2019 13:24:23 +0200 [thread overview] Message-ID: <960d6d68-dff0-1774-8173-b5b1dd0d32f3@xs4all.nl> (raw) In-Reply-To: <20190722060651.6538-1-nishkadg.linux@gmail.com> On 7/22/19 8:06 AM, Nishka Dasgupta wrote: > Typecast as bool the return value of cedrus_find_format in > cedrus_check_format as the return value of cedrus_check_format is always > treated like a boolean value. > > Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com> > --- > Changes in v2: > - Add !! to the returned pointer to ensure that the return value is > always either true or false, and never a non-zero value other than > true. > > drivers/staging/media/sunxi/cedrus/cedrus_video.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c > index e2b530b1a956..b731745f21f8 100644 > --- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c > +++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c > @@ -86,7 +86,7 @@ static struct cedrus_format *cedrus_find_format(u32 pixelformat, u32 directions, > static bool cedrus_check_format(u32 pixelformat, u32 directions, > unsigned int capabilities) > { > - return cedrus_find_format(pixelformat, directions, capabilities); > + return !!(bool)cedrus_find_format(pixelformat, directions, capabilities); Why not write: return cedrus_find_format(pixelformat, directions, capabilities) != NULL; That way coccinelle should be happy, and it is clear that cedrus_find_format returns a pointer and that we return true if it is non-NULL. Regards, Hans > } > > static void cedrus_prepare_format(struct v4l2_pix_format *pix_fmt) > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-07-25 11:24 UTC|newest] Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-07-22 6:06 [PATCH v2] staging: media: sunxi: Add bool cast to value Nishka Dasgupta 2019-07-22 6:06 ` Nishka Dasgupta 2019-07-22 6:06 ` Nishka Dasgupta 2019-07-22 11:12 ` Jeremy Sowden 2019-07-22 11:12 ` Jeremy Sowden 2019-07-22 11:12 ` Jeremy Sowden 2019-07-22 11:12 ` Jeremy Sowden 2019-07-22 12:24 ` Paul Kocialkowski 2019-07-22 12:24 ` Paul Kocialkowski 2019-07-22 12:24 ` Paul Kocialkowski 2019-07-22 13:19 ` Jeremy Sowden 2019-07-22 13:19 ` Jeremy Sowden 2019-07-22 13:19 ` Jeremy Sowden 2019-07-22 13:44 ` Nishka Dasgupta 2019-07-22 13:44 ` Nishka Dasgupta 2019-07-22 13:44 ` Nishka Dasgupta 2019-07-22 15:05 ` Paul Kocialkowski 2019-07-22 15:05 ` Paul Kocialkowski 2019-07-22 15:05 ` Paul Kocialkowski 2019-07-22 15:58 ` Sakari Ailus 2019-07-22 15:58 ` Sakari Ailus 2019-07-22 15:58 ` Sakari Ailus 2019-07-23 7:16 ` Paul Kocialkowski 2019-07-23 7:16 ` Paul Kocialkowski 2019-07-23 7:16 ` Paul Kocialkowski 2019-07-25 11:24 ` Hans Verkuil [this message] 2019-07-25 11:24 ` Hans Verkuil
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=960d6d68-dff0-1774-8173-b5b1dd0d32f3@xs4all.nl \ --to=hverkuil@xs4all.nl \ --cc=devel@driverdev.osuosl.org \ --cc=gregkh@linuxfoundation.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-media@vger.kernel.org \ --cc=maxime.ripard@bootlin.com \ --cc=mchehab@kernel.org \ --cc=nishkadg.linux@gmail.com \ --cc=paul.kocialkowski@bootlin.com \ --cc=wens@csie.org \ /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: linkBe 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.