From: Lukas Wunner Date: Fri, 1 Jul 2022 20:47:53 +0000 (+0200) Subject: usbnet: smsc95xx: Clean up unnecessary BUG_ON() upon register access X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=03b3df43ce1f64b2ec6ef8cbcf2006f3938643b2;p=linux.git usbnet: smsc95xx: Clean up unnecessary BUG_ON() upon register access smsc95xx_read_reg() and smsc95xx_write_reg() call BUG_ON() if the struct usbnet pointer passed in is NULL. The functions have just been amended to dereference the pointer on entry. So the kernel now oopses if the pointer is NULL, eliminating the need for an explicit BUG_ON(). Signed-off-by: Lukas Wunner Signed-off-by: David S. Miller --- diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 5458629cf694c..bfb58c91db047 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -86,8 +86,6 @@ static int __must_check smsc95xx_read_reg(struct usbnet *dev, u32 index, int ret; int (*fn)(struct usbnet *, u8, u8, u16, u16, void *, u16); - BUG_ON(!dev); - if (current != pdata->pm_task) fn = usbnet_read_cmd; else @@ -117,8 +115,6 @@ static int __must_check smsc95xx_write_reg(struct usbnet *dev, u32 index, int ret; int (*fn)(struct usbnet *, u8, u8, u16, u16, const void *, u16); - BUG_ON(!dev); - if (current != pdata->pm_task) fn = usbnet_write_cmd; else