Skip to content
/ linux Public

Commit 804034c

Browse files
Yuuoniyjwrdegoede
authored andcommitted
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>
1 parent 7d0c009 commit 804034c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/platform/mellanox/mlxbf-pmc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,8 +1374,8 @@ static int mlxbf_pmc_map_counters(struct device *dev)
13741374
pmc->block[i].counters = info[2];
13751375
pmc->block[i].type = info[3];
13761376

1377-
if (IS_ERR(pmc->block[i].mmio_base))
1378-
return PTR_ERR(pmc->block[i].mmio_base);
1377+
if (!pmc->block[i].mmio_base)
1378+
return -ENOMEM;
13791379

13801380
ret = mlxbf_pmc_create_groups(dev, i);
13811381
if (ret)

0 commit comments

Comments
 (0)