]> git.baikalelectronics.ru Git - kernel.git/commit
can: gs_usb: gs_usb_set_phys_id(): return with error if identify is not supported
authorMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 18 Aug 2022 12:10:08 +0000 (14:10 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Wed, 21 Sep 2022 07:48:52 +0000 (09:48 +0200)
commitbf56387966cdf64e515763ed78d638b43c946cf1
treed2291d819e75d2c4939537d2fccf34e7f5becfb2
parent5a3df7bc64c8e7431d054e95ece12fcaff9f3dc8
can: gs_usb: gs_usb_set_phys_id(): return with error if identify is not supported

Until commit 51aaef8511a1 ("can: tree-wide: advertise software
timestamping capabilities") the ethtool_ops was only assigned for
devices which support the GS_CAN_FEATURE_IDENTIFY feature. That commit
assigns ethtool_ops unconditionally.

This results on controllers without GS_CAN_FEATURE_IDENTIFY support
for the following ethtool error:

| $ ethtool -p can0 1
| Cannot identify NIC: Broken pipe

Restore the correct error value by checking for
GS_CAN_FEATURE_IDENTIFY in the gs_usb_set_phys_id() function.

| $ ethtool -p can0 1
| Cannot identify NIC: Operation not supported

While there use the variable "netdev" for the "struct net_device"
pointer and "dev" for the "struct gs_can" pointer as in the rest of
the driver.

Fixes: 51aaef8511a1 ("can: tree-wide: advertise software timestamping capabilities")
Link: http://lore.kernel.org/all/20220818143853.2671854-1-mkl@pengutronix.de
Cc: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/usb/gs_usb.c