powercap: intel_rapl: Fix a NULL vs IS_ERR() bug
Subsystems (2)
PATCH 1/1 powercap: intel_rapl: Fix a NULL vs IS_ERR() bug
The devm_ioremap_resource() function returns error pointers on error, it never returns NULL. Update the check accordingly.
--- drivers/powercap/intel_rapl_tpmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/powercap/intel_rapl_tpmi.c +2 -2
@@ -255,8 +255,8 @@ static int intel_rapl_tpmi_probe(struct auxiliary_device *auxdev, } trp->base =devm_ioremap_resource (&auxdev->dev, res); -if (!trp->base) { - ret = -ENOMEM ; +if (IS_ERR (trp->base)) { + ret =PTR_ERR (trp->base); goto err; }
Signature · 1 line
2.39.2
Quoted 6 lines · Dan Carpenter
The
devm_ioremap_resource()function returns error pointers on error, it never returns NULL. Update the check accordingly.Fixes 9eef7f9da928 ("powercap: intel_rapl: Introduce RAPL TPMIinterface driver")
Signed-off-by Dan Carpenter <[email protected]>
thanks,
rui
Quoted 21 lines
---
drivers/powercap/intel_rapl_tpmi.c | 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)drivers/powercap/intel_rapl_tpmi.c +0
-0@@ -255,8 +255,8 @@ static int intel_rapl_tpmi_probe(struct auxiliary_device *auxdev, }
trp->base =devm_ioremap_resource(&auxdev->dev, res); - if (!trp->base) {
- ret =-ENOMEM;
+ if (IS_ERR(trp->base)) {
+ ret =PTR_ERR(trp->base);
goto err;
}
Quoted 10 lines · Rui
Quoted 6 lines · Dan Carpenter
The
devm_ioremap_resource()function returns error pointers on error, it never returns NULL. Update the check accordingly.Fixes 9eef7f9da928 ("powercap: intel_rapl: Introduce RAPL TPMIinterface driver")
Signed-off-by Dan Carpenter <[email protected]>Acked-by Zhang Rui <[email protected]>
Applied as 6.5 material, thanks!
Quoted 22 lines
Quoted 21 lines
--- drivers/powercap/intel_rapl_tpmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/powercap/intel_rapl_tpmi.c +2
-2@@ -255,8 +255,8 @@ static int intel_rapl_tpmi_probe(struct auxiliary_device *auxdev, } trp->base =devm_ioremap_resource (&auxdev->dev, res); -if (!trp->base) { - ret = -ENOMEM ; +if (IS_ERR (trp->base)) { + ret =PTR_ERR (trp->base); goto err; }