{
struct dsa_priv *priv;
- if (!dev || !dev_get_uclass_priv(dev))
- return -ENODEV;
+ if (!dev)
+ return -EINVAL;
if (headroom + tailroom > DSA_MAX_OVR)
return -EINVAL;
/* returns the DSA master Ethernet device */
struct udevice *dsa_get_master(struct udevice *dev)
{
- struct dsa_priv *priv = dev_get_uclass_priv(dev);
+ struct dsa_priv *priv;
- if (!priv)
+ if (!dev)
return NULL;
+ priv = dev_get_uclass_priv(dev);
+
return priv->master_dev;
}
struct dsa_ops *ops = dsa_get_ops(dev);
int err;
- if (!priv)
- return -ENODEV;
-
if (!master) {
dev_err(pdev, "DSA master Ethernet device not found!\n");
return -EINVAL;
struct udevice *master = dsa_get_master(dev);
struct dsa_ops *ops = dsa_get_ops(dev);
- if (!priv)
- return;
-
if (ops->port_disable) {
struct dsa_port_pdata *port_pdata;
ofnode node = dev_ofnode(dev), pnode;
int i, err, first_err = 0;
- if (!pdata || !ofnode_valid(node))
+ if (!ofnode_valid(node))
return -ENODEV;
pdata->master_node = ofnode_null();
struct dsa_pdata *pdata = dev_get_uclass_plat(dev);
struct dsa_priv *priv = dev_get_uclass_priv(dev);
- if (!pdata || !priv)
- return -ENODEV;
-
priv->num_ports = pdata->num_ports;
priv->cpu_port = pdata->cpu_port;
priv->cpu_port_fixed_phy = fixed_phy_create(pdata->cpu_port_node);