* [PATCH] platform/mellanox: mlxbf-pmc: Fix an IS_ERR() vs NULL bug in mlxbf_pmc_map_counters
@ 2021-12-10 7:07 Miaoqian Lin
2021-12-21 17:54 ` Hans de Goede
0 siblings, 1 reply; 2+ messages in thread
From: Miaoqian Lin @ 2021-12-10 7:07 UTC (permalink / raw)
Cc: linmq006, Hans de Goede, Mark Gross, Vadim Pasternak,
platform-driver-x86, linux-kernel
The devm_ioremap() function returns NULL on error, it doesn't return
error pointers. Also according to doc of device_property_read_u64_array,
values in info array are properties of device or NULL.
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
drivers/platform/mellanox/mlxbf-pmc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/mellanox/mlxbf-pmc.c b/drivers/platform/mellanox/mlxbf-pmc.c
index 04bc3b50aa7a..65b4a819f1bd 100644
--- a/drivers/platform/mellanox/mlxbf-pmc.c
+++ b/drivers/platform/mellanox/mlxbf-pmc.c
@@ -1374,8 +1374,8 @@ static int mlxbf_pmc_map_counters(struct device *dev)
pmc->block[i].counters = info[2];
pmc->block[i].type = info[3];
- if (IS_ERR(pmc->block[i].mmio_base))
- return PTR_ERR(pmc->block[i].mmio_base);
+ if (!pmc->block[i].mmio_base)
+ return -ENOMEM;
ret = mlxbf_pmc_create_groups(dev, i);
if (ret)
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] platform/mellanox: mlxbf-pmc: Fix an IS_ERR() vs NULL bug in mlxbf_pmc_map_counters
2021-12-10 7:07 [PATCH] platform/mellanox: mlxbf-pmc: Fix an IS_ERR() vs NULL bug in mlxbf_pmc_map_counters Miaoqian Lin
@ 2021-12-21 17:54 ` Hans de Goede
0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2021-12-21 17:54 UTC (permalink / raw)
To: Miaoqian Lin
Cc: Mark Gross, Vadim Pasternak, platform-driver-x86, linux-kernel
Hi,
On 12/10/21 08:07, Miaoqian Lin wrote:
> The devm_ioremap() function returns NULL on error, it doesn't return
> error pointers. Also according to doc of device_property_read_u64_array,
> values in info array are properties of device or NULL.
>
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Thank you for your patch, I've applied this patch to my review-hans
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.
Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.
Regards,
Hans
> ---
> drivers/platform/mellanox/mlxbf-pmc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/platform/mellanox/mlxbf-pmc.c b/drivers/platform/mellanox/mlxbf-pmc.c
> index 04bc3b50aa7a..65b4a819f1bd 100644
> --- a/drivers/platform/mellanox/mlxbf-pmc.c
> +++ b/drivers/platform/mellanox/mlxbf-pmc.c
> @@ -1374,8 +1374,8 @@ static int mlxbf_pmc_map_counters(struct device *dev)
> pmc->block[i].counters = info[2];
> pmc->block[i].type = info[3];
>
> - if (IS_ERR(pmc->block[i].mmio_base))
> - return PTR_ERR(pmc->block[i].mmio_base);
> + if (!pmc->block[i].mmio_base)
> + return -ENOMEM;
>
> ret = mlxbf_pmc_create_groups(dev, i);
> if (ret)
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-21 17:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-10 7:07 [PATCH] platform/mellanox: mlxbf-pmc: Fix an IS_ERR() vs NULL bug in mlxbf_pmc_map_counters Miaoqian Lin
2021-12-21 17:54 ` Hans de Goede
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox