* [PATCH] usbnet: ipheth: Remove unnecessary NULL pointer check
@ 2019-05-01 0:35 Guenter Roeck
2019-05-04 4:00 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Guenter Roeck @ 2019-05-01 0:35 UTC (permalink / raw)
To: David S . Miller
Cc: linux-usb, netdev, linux-kernel, Guenter Roeck, Gustavo A . R . Silva
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.
Cc: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/net/usb/ipheth.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
index a01a71a7e48d..c247aed2dceb 100644
--- a/drivers/net/usb/ipheth.c
+++ b/drivers/net/usb/ipheth.c
@@ -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;
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] usbnet: ipheth: Remove unnecessary NULL pointer check
2019-05-01 0:35 [PATCH] usbnet: ipheth: Remove unnecessary NULL pointer check Guenter Roeck
@ 2019-05-04 4:00 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-05-04 4:00 UTC (permalink / raw)
To: linux; +Cc: linux-usb, netdev, linux-kernel, garsilva
From: Guenter Roeck <linux@roeck-us.net>
Date: Tue, 30 Apr 2019 17:35:33 -0700
> 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.
>
> Cc: Gustavo A. R. Silva <garsilva@embeddedor.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Applied to net-next.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-04 4:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-01 0:35 [PATCH] usbnet: ipheth: Remove unnecessary NULL pointer check Guenter Roeck
2019-05-04 4:00 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).