[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1590563743-30707-1-git-send-email-yangtiezhu@loongson.cn>
Date: Wed, 27 May 2020 15:15:42 +0800
From: Tiezhu Yang <yangtiezhu@...ngson.cn>
To: Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>
Cc: linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org,
Xuefeng Li <lixuefeng@...ngson.cn>,
Tiezhu Yang <yangtiezhu@...ngson.cn>
Subject: [PATCH v2 1/2] clk: hisilicon: Use correct return value about hisi_reset_init()
The return value about hisi_reset_init() is not correct, fix it.
Fixes: e9a2310fb689 ("reset: hisilicon: fix potential NULL pointer dereference")
Signed-off-by: Tiezhu Yang <yangtiezhu@...ngson.cn>
---
v2:
- No changes, just add "Fixes:" tag
drivers/clk/hisilicon/clk-hi3519.c | 4 ++--
drivers/clk/hisilicon/crg-hi3516cv300.c | 4 ++--
drivers/clk/hisilicon/crg-hi3798cv200.c | 4 ++--
drivers/clk/hisilicon/reset.c | 4 ++--
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/clk/hisilicon/clk-hi3519.c b/drivers/clk/hisilicon/clk-hi3519.c
index ad0c7f3..803fa66 100644
--- a/drivers/clk/hisilicon/clk-hi3519.c
+++ b/drivers/clk/hisilicon/clk-hi3519.c
@@ -149,8 +149,8 @@ static int hi3519_clk_probe(struct platform_device *pdev)
return -ENOMEM;
crg->rstc = hisi_reset_init(pdev);
- if (!crg->rstc)
- return -ENOMEM;
+ if (IS_ERR(crg->rstc))
+ return PTR_ERR(crg->rstc);
crg->clk_data = hi3519_clk_register(pdev);
if (IS_ERR(crg->clk_data)) {
diff --git a/drivers/clk/hisilicon/crg-hi3516cv300.c b/drivers/clk/hisilicon/crg-hi3516cv300.c
index 5d4e61c..c2af03d 100644
--- a/drivers/clk/hisilicon/crg-hi3516cv300.c
+++ b/drivers/clk/hisilicon/crg-hi3516cv300.c
@@ -271,8 +271,8 @@ static int hi3516cv300_crg_probe(struct platform_device *pdev)
return -ENOENT;
crg->rstc = hisi_reset_init(pdev);
- if (!crg->rstc)
- return -ENOMEM;
+ if (IS_ERR(crg->rstc))
+ return PTR_ERR(crg->rstc);
crg->clk_data = crg->funcs->register_clks(pdev);
if (IS_ERR(crg->clk_data)) {
diff --git a/drivers/clk/hisilicon/crg-hi3798cv200.c b/drivers/clk/hisilicon/crg-hi3798cv200.c
index 08a19ba..66fd6a9 100644
--- a/drivers/clk/hisilicon/crg-hi3798cv200.c
+++ b/drivers/clk/hisilicon/crg-hi3798cv200.c
@@ -354,8 +354,8 @@ static int hi3798cv200_crg_probe(struct platform_device *pdev)
return -ENOENT;
crg->rstc = hisi_reset_init(pdev);
- if (!crg->rstc)
- return -ENOMEM;
+ if (IS_ERR(crg->rstc))
+ return PTR_ERR(crg->rstc);
crg->clk_data = crg->funcs->register_clks(pdev);
if (IS_ERR(crg->clk_data)) {
diff --git a/drivers/clk/hisilicon/reset.c b/drivers/clk/hisilicon/reset.c
index 93cee17..f17d15f 100644
--- a/drivers/clk/hisilicon/reset.c
+++ b/drivers/clk/hisilicon/reset.c
@@ -93,11 +93,11 @@ struct hisi_reset_controller *hisi_reset_init(struct platform_device *pdev)
rstc = devm_kmalloc(&pdev->dev, sizeof(*rstc), GFP_KERNEL);
if (!rstc)
- return NULL;
+ return ERR_PTR(-ENOMEM);
rstc->membase = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(rstc->membase))
- return NULL;
+ return rstc->membase;
spin_lock_init(&rstc->lock);
rstc->rcdev.owner = THIS_MODULE;
--
2.1.0
Powered by blists - more mailing lists