Re: [PATCH net-next v3 1/7] net: bridge: Extract boilerplate around switchdev_port_obj_*()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux