From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8258BC76195 for ; Thu, 18 Jul 2019 07:48:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 54A8D205C9 for ; Thu, 18 Jul 2019 07:48:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389350AbfGRHsD (ORCPT ); Thu, 18 Jul 2019 03:48:03 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:56537 "EHLO relay7-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726000AbfGRHsD (ORCPT ); Thu, 18 Jul 2019 03:48:03 -0400 X-Originating-IP: 86.250.200.211 Received: from aptenodytes (lfbn-1-17395-211.w86-250.abo.wanadoo.fr [86.250.200.211]) (Authenticated sender: paul.kocialkowski@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id E97D820007; Thu, 18 Jul 2019 07:47:58 +0000 (UTC) Date: Thu, 18 Jul 2019 09:47:58 +0200 From: Paul Kocialkowski To: Nishka Dasgupta Cc: maxime.ripard@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] staging: media: sunxi: Add bool cast to value Message-ID: <20190718074758.GD26951@aptenodytes> References: <20190717142315.3119-1-nishkadg.linux@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190717142315.3119-1-nishkadg.linux@gmail.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Hi, On Wed 17 Jul 19, 19:53, 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. Thanks for the patch! Could we also add !! to the returned pointer so that we are sure that the function returns either false or true, but never a non-zero value that is not true? Cheers, Paul > Signed-off-by: Nishka Dasgupta > --- > 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..f00a048a0a01 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); > } > > static void cedrus_prepare_format(struct v4l2_pix_format *pix_fmt) > -- > 2.19.1 > -- Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com