From: Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>
To: Nathan Chancellor <nathan@kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>,
Tom Rix <trix@redhat.com>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"llvm@lists.linux.dev" <llvm@lists.linux.dev>,
"patches@lists.linux.dev" <patches@lists.linux.dev>
Subject: RE: [PATCH] media: rzg2l-cru: Remove unnecessary shadowing of ret in rzg2l_csi2_s_stream()
Date: Mon, 28 Nov 2022 23:53:58 +0000 [thread overview]
Message-ID: <OSZPR01MB7019DDDF3BE79CABBD8A582FAA139@OSZPR01MB7019.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <20221128061622.1470489-1-nathan@kernel.org>
Hi Nathan,
Thank you for the patch.
> -----Original Message-----
> From: Nathan Chancellor <nathan@kernel.org>
> Sent: 28 November 2022 06:16
> To: Mauro Carvalho Chehab <mchehab@kernel.org>; Sakari Ailus <sakari.ailus@linux.intel.com>; Prabhakar
> Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Cc: Nick Desaulniers <ndesaulniers@google.com>; Tom Rix <trix@redhat.com>; linux-
> media@vger.kernel.org; linux-kernel@vger.kernel.org; llvm@lists.linux.dev; patches@lists.linux.dev;
> Nathan Chancellor <nathan@kernel.org>
> Subject: [PATCH] media: rzg2l-cru: Remove unnecessary shadowing of ret in rzg2l_csi2_s_stream()
>
> Clang warns:
>
> drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c:445:7: error: variable 'ret' is used
> uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
> if (ret)
> ^~~
> drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c:475:9: note: uninitialized use occurs here
> return ret;
> ^~~
> drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c:445:3: note: remove the 'if' if its condition
> is always false
> if (ret)
> ^~~~~~~~
> drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c:441:7: error: variable 'ret' is used
> uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
> if (ret)
> ^~~
> drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c:475:9: note: uninitialized use occurs here
> return ret;
> ^~~
> drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c:441:3: note: remove the 'if' if its condition
> is always false
> if (ret)
> ^~~~~~~~
> drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c:431:9: note: initialize the variable 'ret' to
> silence this warning
> int ret;
> ^
> = 0
> 2 errors generated.
>
> ret is unnecessarily shadowed, meaning the assignments to ret within the first 'if (enable)' block are
> only applied to the inner scope, not the outer one as intended. Remove the shadowing to fix the
> warnings and make everything work correctly.
>
> Fixes: 51e8415e39a9 ("media: platform: Add Renesas RZ/G2L MIPI CSI-2 receiver driver")
> Link:
> https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FClangBuiltLinux%2Flinux
> %2Fissues%2F1764&data=05%7C01%7Cprabhakar.mahadev-
> lad.rj%40bp.renesas.com%7C76d2a49f939a46e8d15208dad1081ed7%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%
> 7C638052130064697087%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXV
> CI6Mn0%3D%7C3000%7C%7C%7C&sdata=fp%2F1JCtgKY8E6qVMRlLewVLYc9WDZ%2ByNtg6t%2BGqIUvk%3D&reserved=
> 0
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c | 2 --
> 1 file changed, 2 deletions(-)
>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Cheers,
Prabhakar
prev parent reply other threads:[~2022-11-28 23:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-28 6:16 Nathan Chancellor
2022-11-28 23:53 ` Prabhakar Mahadev Lad [this message]
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=OSZPR01MB7019DDDF3BE79CABBD8A582FAA139@OSZPR01MB7019.jpnprd01.prod.outlook.com \
--to=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=patches@lists.linux.dev \
--cc=sakari.ailus@linux.intel.com \
--cc=trix@redhat.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
all inboxes | Powered by JetHome®