[PATCH net-next v3 1/7] net: bridge: Extract boilerplate around switchdev_port_obj_*()
Dan Carpenter
dan.carpenter at oracle.com
Tue May 29 10:35:36 UTC 2018
On Mon, May 28, 2018 at 05:10:28PM +0200, Petr Machata wrote:
> /* Try switchdev op first. In case it is not supported, fallback to
> * 8021q add.
> */
> - err = switchdev_port_obj_add(dev, &v.obj);
> + int err = br_switchdev_port_vlan_add(dev, vid, flags);
> if (err == -EOPNOTSUPP)
This will introduce a checkpatch warning if you re-run with the --file
option. (I haven't tested). It's sort of ugly to put function logic in
the declaration block. That's really just for initializing variables
like "int start = 0; struct foo *p = parent_of_bar();" Do it like this
instead:
int err;
err = br_switchdev_port_vlan_add(dev, vid, flags);
if (err == -EOPNOTSUPP)
regards,
dan carpenter
More information about the devel
mailing list