Subject: Coverity: rk_gmac_setup(): Error handling issues

From: coverity-bot <[email-masked]>
Date: Mon, 11 Nov 2019 17:34:52 -0800

Hello!

This is an experimental automated report about issues detected by Coverity
from a scan of next-20191108 as part of the linux-next weekly scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by recent commits:

0c65b2b90d13 ("net: of_get_phy_mode: Change API to solve int/unit warnings")

Coverity reported the following:

*** CID 1487850:  Error handling issues  (CHECKED_RETURN)
/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c: 1227 in rk_gmac_setup()
1221     	int value;
1222
1223     	bsp_priv = devm_kzalloc(dev, sizeof(*bsp_priv), GFP_KERNEL);
1224     	if (!bsp_priv)
1225     		return ERR_PTR(-ENOMEM);
1226
vvv     CID 1487850:  Error handling issues  (CHECKED_RETURN)
vvv     Calling "of_get_phy_mode" without checking return value (as is done elsewhere 43 out of 44 times).
1227     	of_get_phy_mode(dev->of_node, &bsp_priv->phy_iface);
1228     	bsp_priv->ops = ops;
1229
1230     	bsp_priv->regulator = devm_regulator_get_optional(dev, "phy");
1231     	if (IS_ERR(bsp_priv->regulator)) {
1232     		if (PTR_ERR(bsp_priv->regulator) == -EPROBE_DEFER) {

If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):

Reported-by: coverity-bot <[email-masked]>
Addresses-Coverity-ID: 1487850 ("Error handling issues")
Fixes: 0c65b2b90d13 ("net: of_get_phy_mode: Change API to solve int/unit warnings")

Thanks for your attention!

-- 
Coverity-bot