Skip to content

Commit

Permalink
i2c: muxes: Fix return value check in mule_i2c_mux_probe()
Browse files Browse the repository at this point in the history
If dev_get_regmap() fails, it returns NULL pointer not ERR_PTR(),
replace IS_ERR() with NULL pointer check, and return -ENODEV.

Fixes: d0f8e97 ("i2c: muxes: add support for tsd,mule-i2c multiplexer")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
  • Loading branch information
Yang Yingliang authored and Andi Shyti committed Nov 5, 2024
1 parent 59b723c commit ab2e5c8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/i2c/muxes/i2c-mux-mule.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ static int mule_i2c_mux_probe(struct platform_device *pdev)
priv = i2c_mux_priv(muxc);

priv->regmap = dev_get_regmap(mux_dev->parent, NULL);
if (IS_ERR(priv->regmap))
return dev_err_probe(mux_dev, PTR_ERR(priv->regmap),
if (!priv->regmap)
return dev_err_probe(mux_dev, -ENODEV,
"No parent i2c register map\n");

platform_set_drvdata(pdev, muxc);
Expand Down

0 comments on commit ab2e5c8

Please sign in to comment.