Hi Andrew, Andrew Lunn <and...@lunn.ch> writes:
> @@ -354,13 +354,16 @@ static int dsa_slave_port_attr_get(struct net_device > *dev, > struct switchdev_attr *attr) > { > struct dsa_slave_priv *p = netdev_priv(dev); > - struct dsa_switch *ds = p->dp->ds; > > switch (attr->id) { > - case SWITCHDEV_ATTR_ID_PORT_PARENT_ID: > - attr->u.ppid.id_len = sizeof(ds->index); > - memcpy(&attr->u.ppid.id, &ds->index, attr->u.ppid.id_len); > + case SWITCHDEV_ATTR_ID_PORT_PARENT_ID: { > + struct dsa_switch *ds = p->dp->ds; > + struct dsa_switch_tree *dst = ds->dst; > + > + attr->u.ppid.id_len = sizeof(dst->tree); > + memcpy(&attr->u.ppid.id, &dst->tree, sizeof(dst->tree)); > break; > + } > case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT: > attr->u.brport_flags_support = 0; > break; I am pretty sure the kernel folks won't like blocks within case statments. Simply declare dst = p->dp->ds->dst at the beginning. Also keeping attr->u.ppid.id_len as memcpy's third argument like other switchdev users do would be prefered. Otherwise using the tree index is indeed the way to go: Reviewed-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> Thanks, Vivien