Skip to content

Commit

Permalink
usbnet: smsc95xx: Clean up unnecessary BUG_ON() upon register access
Browse files Browse the repository at this point in the history
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 <lukas@wunner.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Lukas Wunner authored and David S. Miller committed Jul 4, 2022
1 parent 3147242 commit 03b3df4
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions drivers/net/usb/smsc95xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 03b3df4

Please sign in to comment.