Skip to content

Commit

Permalink
net: dsa: realtek: make use of dev_err_cast_probe()
Browse files Browse the repository at this point in the history
Using dev_err_cast_probe() to simplify the code.

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Alvin Šipraga <alsi@bang-olufsen.dk>
Link: https://patch.msgid.link/20240828121805.3696631-1-lihongbo22@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Hongbo Li authored and Jakub Kicinski committed Aug 29, 2024
1 parent a41de3b commit 9023fda
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/net/dsa/realtek/rtl83xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 9023fda

Please sign in to comment.