Commit 9023fda2 authored by Hongbo Li's avatar Hongbo Li Committed by Jakub Kicinski

net: dsa: realtek: make use of dev_err_cast_probe()

Using dev_err_cast_probe() to simplify the code.
Signed-off-by: default avatarHongbo Li <lihongbo22@huawei.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Reviewed-by: default avatarAlvin Šipraga <alsi@bang-olufsen.dk>
Link: https://patch.msgid.link/20240828121805.3696631-1-lihongbo22@huawei.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent a41de3b1
......@@ -185,11 +185,9 @@ rtl83xx_probe(struct device *dev,
/* TODO: if power is software controlled, set up any regulators here */
priv->reset_ctl = devm_reset_control_get_optional(dev, NULL);
if (IS_ERR(priv->reset_ctl)) {
ret = PTR_ERR(priv->reset_ctl);
dev_err_probe(dev, ret, "failed to get reset control\n");
return ERR_CAST(priv->reset_ctl);
}
if (IS_ERR(priv->reset_ctl))
return dev_err_cast_probe(dev, priv->reset_ctl,
"failed to get reset control\n");
priv->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
if (IS_ERR(priv->reset)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment