From: matthias.bgg@kernel.org
To: dan.carpenter@oracle.com, johnson.wang@mediatek.com
Cc: linux-pm@vger.kernel.org, linux-mediatek@lists.infradead.org,
Matthias Brugger <matthias.bgg@gmail.com>
Subject: [PATCH] PM / devfreq: mediatek: Fix possible dereference of null pointer
Date: Fri, 17 Jun 2022 15:33:31 +0200 [thread overview]
Message-ID: <20220617133330.6510-1-matthias.bgg@kernel.org> (raw)
From: Matthias Brugger <matthias.bgg@gmail.com>
We dereference the driver data before checking of it's valid.
This patch fixes this, by accessing the PLL data struct after cheching
the pointer
Fixes: 07dc787be231 ("Add linux-next specific files for 20220617")
Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
---
drivers/devfreq/mtk-cci-devfreq.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/devfreq/mtk-cci-devfreq.c b/drivers/devfreq/mtk-cci-devfreq.c
index 71abb3fbd042..77522f16c878 100644
--- a/drivers/devfreq/mtk-cci-devfreq.c
+++ b/drivers/devfreq/mtk-cci-devfreq.c
@@ -127,7 +127,7 @@ static int mtk_ccifreq_target(struct device *dev, unsigned long *freq,
u32 flags)
{
struct mtk_ccifreq_drv *drv = dev_get_drvdata(dev);
- struct clk *cci_pll = clk_get_parent(drv->cci_clk);
+ struct clk *cci_pll;
struct dev_pm_opp *opp;
unsigned long opp_rate;
int voltage, pre_voltage, inter_voltage, target_voltage, ret;
@@ -138,6 +138,7 @@ static int mtk_ccifreq_target(struct device *dev, unsigned long *freq,
if (drv->pre_freq == *freq)
return 0;
+ cci_pll = clk_get_parent(drv->cci_clk);
inter_voltage = drv->inter_voltage;
opp_rate = *freq;
--
2.36.0
next reply other threads:[~2022-06-17 13:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-17 13:33 matthias.bgg [this message]
2022-06-20 14:21 ` [PATCH] PM / devfreq: mediatek: Fix possible dereference of null pointer AngeloGioacchino Del Regno
2022-06-20 15:37 ` Matthias Brugger
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=20220617133330.6510-1-matthias.bgg@kernel.org \
--to=matthias.bgg@kernel.org \
--cc=dan.carpenter@oracle.com \
--cc=johnson.wang@mediatek.com \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=matthias.bgg@gmail.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