usbnet: ipheth: Remove unnecessary NULL pointer check
Subsystems (4)
PATCH 1/1 usbnet: ipheth: Remove unnecessary NULL pointer check
ipheth_carrier_set() is called from two locations. In ipheth_carrier_check_work(), its parameter 'dev' is set with container_of(work, ...) and can not be NULL. In ipheth_open(), dev is extracted from netdev_priv(net) and dereferenced before the call to ipheth_carrier_set(). The NULL pointer check of dev in ipheth_carrier_set() is therefore unnecessary and can be removed.
--- drivers/net/usb/ipheth.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/usb/ipheth.c +0 -2
@@ -241,8 +241,6 @@ static int ipheth_carrier_set(struct ipheth_device *dev)struct usb_device *udev;int retval; -if (!dev) -return 0 ;if (!dev->confirmed_pairing)return 0 ;
From: Guenter Roeck <[email protected]>
Date: Tue, 30 Apr 2019 17:35:33 -0700
Quoted 9 lines
ipheth_carrier_set()is called from two locations. Inipheth_carrier_check_work(), its parameter 'dev' is set withcontainer_of(work, ...)and can not be NULL. Inipheth_open(), dev is extracted fromnetdev_priv(net)and dereferenced before the call toipheth_carrier_set(). The NULL pointer check of dev inipheth_carrier_set()is therefore unnecessary and can be removed.Cc Gustavo A. R. Silva <[email protected]>Signed-off-by Guenter Roeck <[email protected]>
Applied to net-next.