Re: [PATCH next] perf: arm-ni: Fix an NULL vs IS_ERR() bug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2024-09-11 8:39 am, Dan Carpenter wrote:
The devm_ioremap() function never returns error pointers, it returns a
NULL pointer if there is an error.

Ah, this code went through a few evolutions, and apparently I missed that devm_ioremap() and devm_ioremap_resource() helpfully have different behaviour, urgh. Thanks Dan!

Reviewed-by: Robin Murphy <robin.murphy@xxxxxxx>

Fixes: 4d5a7680f2b4 ("perf: Add driver for Arm NI-700 interconnect PMU")
Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
  drivers/perf/arm-ni.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/perf/arm-ni.c b/drivers/perf/arm-ni.c
index b72df3aea93e..90fcfe693439 100644
--- a/drivers/perf/arm-ni.c
+++ b/drivers/perf/arm-ni.c
@@ -603,8 +603,8 @@ static int arm_ni_probe(struct platform_device *pdev)
  	 */
  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  	base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
-	if (IS_ERR(base))
-		return PTR_ERR(base);
+	if (!base)
+		return -ENOMEM;
arm_ni_probe_domain(base, &cfg);
  	if (cfg.type != NI_GLOBAL)




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux