mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-14 04:46:01 +01:00
net: Fix static checker warnings
Here are the smatch warning messages: drivers/net/xilinx_axi_emac.c:324 axiemac_phy_init() error: 'phydev' dereferencing possible ERR_PTR() drivers/net/zynq_gem.c:340 zynq_phy_init() error: 'priv->phydev' dereferencing possible ERR_PTR() Fix by adding error checking before dereferencing the pointer. Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com> Link: https://lore.kernel.org/r/20220929045605.23964-1-venkatesh.abbarapu@amd.com Signed-off-by: Michal Simek <michal.simek@amd.com>
This commit is contained in:
parent
e1a193b951
commit
9a082d2548
@ -11,6 +11,7 @@
|
|||||||
#include <cpu_func.h>
|
#include <cpu_func.h>
|
||||||
#include <display_options.h>
|
#include <display_options.h>
|
||||||
#include <dm.h>
|
#include <dm.h>
|
||||||
|
#include <dm/device_compat.h>
|
||||||
#include <log.h>
|
#include <log.h>
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
@ -317,6 +318,10 @@ static int axiemac_phy_init(struct udevice *dev)
|
|||||||
|
|
||||||
/* Interface - look at tsec */
|
/* Interface - look at tsec */
|
||||||
phydev = phy_connect(priv->bus, priv->phyaddr, dev, priv->interface);
|
phydev = phy_connect(priv->bus, priv->phyaddr, dev, priv->interface);
|
||||||
|
if (IS_ERR_OR_NULL(phydev)) {
|
||||||
|
dev_err(dev, "phy_connect() failed\n");
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
phydev->supported &= supported;
|
phydev->supported &= supported;
|
||||||
phydev->advertising = phydev->supported;
|
phydev->advertising = phydev->supported;
|
||||||
|
@ -328,7 +328,7 @@ static int zynq_phy_init(struct udevice *dev)
|
|||||||
|
|
||||||
priv->phydev = phy_connect(priv->bus, priv->phyaddr, dev,
|
priv->phydev = phy_connect(priv->bus, priv->phyaddr, dev,
|
||||||
priv->interface);
|
priv->interface);
|
||||||
if (!priv->phydev)
|
if (IS_ERR_OR_NULL(priv->phydev))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
if (priv->max_speed) {
|
if (priv->max_speed) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user