Skip to content

Commit

Permalink
platform/mellanox: mlxbf-pmc: Fix an IS_ERR() vs NULL bug in mlxbf_pm…
Browse files Browse the repository at this point in the history
…c_map_counters

[ Upstream commit 804034c ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Yuuoniy authored and gregkh committed Jan 5, 2022
1 parent e96373f commit 6964e81
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/platform/mellanox/mlxbf-pmc.c
Expand Up @@ -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)
Expand Down

0 comments on commit 6964e81

Please sign in to comment.