All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Viresh Kumar <vireshk@kernel.org>, Nishanth Menon <nm@ti.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Georgi Djakov <georgi.djakov@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>, Sibi Sankar <sibis@codeaurora.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Matthias Kaehlcke <mka@chromium.org>,
	Rajendra Nayak <rnayak@codeaurora.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] opp: avoid uninitialized-variable use
Date: Fri, 29 May 2020 22:17:16 +0200	[thread overview]
Message-ID: <20200529201731.545859-1-arnd@arndb.de> (raw)

An uninitialized pointer is passed into another function but
ignored there:

drivers/opp/core.c:875:32: error: variable 'opp' is uninitialized when used here [-Werror,-Wuninitialized]
                ret = _set_opp_bw(opp_table, opp, dev, true);
                                             ^~~
drivers/opp/core.c:849:34: note: initialize the variable 'opp' to silence this warning
        struct dev_pm_opp *old_opp, *opp;
                                        ^

gcc no longer warns about this, but it seems it really should,
so change the code to just pass a NULL pointer here.

See-also: 78a5255ffb6a ("Stop the ad-hoc games with -Wno-maybe-initialized")
Fixes: c57afacc9270 ("opp: Remove bandwidth votes when target_freq is zero")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/opp/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index df12c3804533..7302f2631f8d 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -872,7 +872,7 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
 			goto put_opp_table;
 		}
 
-		ret = _set_opp_bw(opp_table, opp, dev, true);
+		ret = _set_opp_bw(opp_table, NULL, dev, true);
 		if (ret)
 			return ret;
 
-- 
2.26.2


             reply	other threads:[~2020-05-29 20:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-29 20:17 Arnd Bergmann [this message]
2020-05-30  9:20 ` [PATCH] opp: avoid uninitialized-variable use Viresh Kumar
2020-05-30 12:40   ` Arnd Bergmann
2020-06-01  3:32     ` Viresh Kumar

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=20200529201731.545859-1-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=georgi.djakov@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=nm@ti.com \
    --cc=rnayak@codeaurora.org \
    --cc=sboyd@kernel.org \
    --cc=sibis@codeaurora.org \
    --cc=viresh.kumar@linaro.org \
    --cc=vireshk@kernel.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 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.