Message ID | ZH7s0qNJ8a/KHjvQ@moroto (mailing list archive) |
---|---|
State | Mainlined, archived |
Headers | show |
Series | powercap: intel_rapl: Fix a NULL vs IS_ERR() bug | expand |
On Tue, 2023-06-06 at 11:22 +0300, Dan Carpenter wrote: > 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 TPMI > interface driver") > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Acked-by: Zhang Rui <rui.zhang@intel.com> thanks, rui > --- > drivers/powercap/intel_rapl_tpmi.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/powercap/intel_rapl_tpmi.c > b/drivers/powercap/intel_rapl_tpmi.c > index c016127b3497..4f4f13ded225 100644 > --- a/drivers/powercap/intel_rapl_tpmi.c > +++ b/drivers/powercap/intel_rapl_tpmi.c > @@ -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; > } >
On Tue, Jun 6, 2023 at 10:56 AM Zhang, Rui <rui.zhang@intel.com> wrote: > > On Tue, 2023-06-06 at 11:22 +0300, Dan Carpenter wrote: > > 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 TPMI > > interface driver") > > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> > > Acked-by: Zhang Rui <rui.zhang@intel.com> Applied as 6.5 material, thanks! > > --- > > drivers/powercap/intel_rapl_tpmi.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/powercap/intel_rapl_tpmi.c > > b/drivers/powercap/intel_rapl_tpmi.c > > index c016127b3497..4f4f13ded225 100644 > > --- a/drivers/powercap/intel_rapl_tpmi.c > > +++ b/drivers/powercap/intel_rapl_tpmi.c > > @@ -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; > > } > > >
diff --git a/drivers/powercap/intel_rapl_tpmi.c b/drivers/powercap/intel_rapl_tpmi.c index c016127b3497..4f4f13ded225 100644 --- a/drivers/powercap/intel_rapl_tpmi.c +++ b/drivers/powercap/intel_rapl_tpmi.c @@ -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; }
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 TPMI interface driver") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> --- drivers/powercap/intel_rapl_tpmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)