linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] perf/marvell_cn10k_tad_pmu: Fix return value check in tad_pmu_probe()
@ 2021-12-21 11:22 Yang Yingliang
  2022-01-04 15:11 ` Will Deacon
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2021-12-21 11:22 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel; +Cc: will, bbudiredla

In case of error, the function devm_ioremap() returns NULL
pointer not ERR_PTR(). The IS_ERR() test in the return value
check should be replaced with NULL test.

Fixes: 036a7584bede ("drivers: perf: Add LLC-TAD perf counter support")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/perf/marvell_cn10k_tad_pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/perf/marvell_cn10k_tad_pmu.c b/drivers/perf/marvell_cn10k_tad_pmu.c
index 250dd4c52d70..7f4d292658e3 100644
--- a/drivers/perf/marvell_cn10k_tad_pmu.c
+++ b/drivers/perf/marvell_cn10k_tad_pmu.c
@@ -312,7 +312,7 @@ static int tad_pmu_probe(struct platform_device *pdev)
 		regions[i].base = devm_ioremap(&pdev->dev,
 					       res->start,
 					       tad_pmu_page_size);
-		if (IS_ERR(regions[i].base)) {
+		if (!regions[i].base) {
 			dev_err(&pdev->dev, "TAD%d ioremap fail\n", i);
 			return -ENOMEM;
 		}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] perf/marvell_cn10k_tad_pmu: Fix return value check in tad_pmu_probe()
  2021-12-21 11:22 [PATCH -next] perf/marvell_cn10k_tad_pmu: Fix return value check in tad_pmu_probe() Yang Yingliang
@ 2022-01-04 15:11 ` Will Deacon
  0 siblings, 0 replies; 2+ messages in thread
From: Will Deacon @ 2022-01-04 15:11 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: linux-kernel, linux-arm-kernel, bbudiredla

On Tue, Dec 21, 2021 at 07:22:52PM +0800, Yang Yingliang wrote:
> In case of error, the function devm_ioremap() returns NULL
> pointer not ERR_PTR(). The IS_ERR() test in the return value
> check should be replaced with NULL test.
> 
> Fixes: 036a7584bede ("drivers: perf: Add LLC-TAD perf counter support")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/perf/marvell_cn10k_tad_pmu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/perf/marvell_cn10k_tad_pmu.c b/drivers/perf/marvell_cn10k_tad_pmu.c
> index 250dd4c52d70..7f4d292658e3 100644
> --- a/drivers/perf/marvell_cn10k_tad_pmu.c
> +++ b/drivers/perf/marvell_cn10k_tad_pmu.c
> @@ -312,7 +312,7 @@ static int tad_pmu_probe(struct platform_device *pdev)
>  		regions[i].base = devm_ioremap(&pdev->dev,
>  					       res->start,
>  					       tad_pmu_page_size);
> -		if (IS_ERR(regions[i].base)) {
> +		if (!regions[i].base) {
>  			dev_err(&pdev->dev, "TAD%d ioremap fail\n", i);
>  			return -ENOMEM;

Thanks, but Dan already caught this:

https://lore.kernel.org/r/20211217145907.GA16611@kili

I'll push out his fix soon.

Will

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-04 15:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-21 11:22 [PATCH -next] perf/marvell_cn10k_tad_pmu: Fix return value check in tad_pmu_probe() Yang Yingliang
2022-01-04 15:11 ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).