public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: mturquette@baylibre.com, sboyd@kernel.org,
	matthias.bgg@gmail.com, kishan.dudhatra@siliconsignals.io
Cc: Chen-Yu Tsai <wenst@chromium.org>, Tom Rix <trix@redhat.com>,
	linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH] clk: mediatek: fix cppcheck error for uninitialized variable
Date: Tue, 2 Jan 2024 10:41:45 +0100	[thread overview]
Message-ID: <0bfa27e8-c173-4a2a-b453-9289f2eb1926@collabora.com> (raw)
In-Reply-To: <20231225152806.3716898-1-user@falcon>

Il 25/12/23 16:28,  ha scritto:
> From: Kishan Dudhatra <kishan.dudhatra@siliconsignals.io>
> 
> cppcheck reports below warning
> 
> clk/mediatek/clk-fhctl.c:206:27:
> error: Uninitialized variable: pll_postdiv [uninitvar]
> if (postdiv && postdiv < pll_postdiv)
> 
> This is due to uninitialization of variable pll_postdiv,
> which is now initialized as part of this patch.
> 
> Signed-off-by: Kishan Dudhatra <kishan.dudhatra@siliconsignals.io>

This is a false positive... the pll_postdiv variable is *always* used
and *only if* postdiv > 0.

P.S.: There was some problem with your email, as the From entry is empty.

Regards,
Angelo

> 
> diff --git a/drivers/clk/mediatek/clk-fhctl.c b/drivers/clk/mediatek/clk-fhctl.c
> index 33b6ad8fdc2e..b0e71e4fd938 100644
> --- a/drivers/clk/mediatek/clk-fhctl.c
> +++ b/drivers/clk/mediatek/clk-fhctl.c
> @@ -186,7 +186,7 @@ static int fhctl_hopping(struct mtk_fh *fh, unsigned int new_dds,
>   	struct fh_pll_regs *regs = &fh->regs;
>   	struct mtk_clk_pll *pll = &fh->clk_pll;
>   	spinlock_t *lock = fh->lock;
> -	unsigned int pll_postdiv;
> +	unsigned int pll_postdiv = 0;
>   	unsigned long flags = 0;
>   	int ret;
>   



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2024-01-02  9:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-25 15:28 [PATCH] clk: mediatek: fix cppcheck error for uninitialized variable 
2024-01-02  9:41 ` AngeloGioacchino Del Regno [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=0bfa27e8-c173-4a2a-b453-9289f2eb1926@collabora.com \
    --to=angelogioacchino.delregno@collabora.com \
    --cc=kishan.dudhatra@siliconsignals.io \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    --cc=trix@redhat.com \
    --cc=wenst@chromium.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: 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