diff options
author | Miaoqian Lin <linmq006@gmail.com> | 2021-12-10 07:07:53 +0000 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2021-12-21 18:52:26 +0100 |
commit | cfc643aa23c8855b92f9302e99a54dbf5857c1ab (patch) | |
tree | 2aa3b2354e0b0ed058b1bb75829d1358d66a7d6a /drivers/platform | |
parent | 426c0ff27b833939ed434b4a468bdc010864922a (diff) | |
download | linux-stable-cfc643aa23c8855b92f9302e99a54dbf5857c1ab.tar.gz linux-stable-cfc643aa23c8855b92f9302e99a54dbf5857c1ab.tar.bz2 linux-stable-cfc643aa23c8855b92f9302e99a54dbf5857c1ab.zip |
platform/mellanox: mlxbf-pmc: Fix an IS_ERR() vs NULL bug in mlxbf_pmc_map_counters
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>
Link: https://lore.kernel.org/r/20211210070753.10761-1-linmq006@gmail.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/mellanox/mlxbf-pmc.c | 4 |
1 files 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) |