Skip to content

Commit 1eecc7a

Browse files
oleremdavem330
authored andcommitted
net: lan78xx: fix runtime PM count underflow on link stop
Current driver has some asymmetry in the runtime PM calls. On lan78xx_open() it will call usb_autopm_get() and unconditionally usb_autopm_put(). And on lan78xx_stop() it will call only usb_autopm_put(). So far, it was working only because this driver do not activate autosuspend by default, so it was visible only by warning "Runtime PM usage count underflow!". Since, with current driver, we can't use runtime PM with active link, execute lan78xx_open()->usb_autopm_put() only in error case. Otherwise, keep ref counting high as long as interface is open. Fixes: 55d7de9 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver") Signed-off-by: Oleksij Rempel <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7be4088 commit 1eecc7a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/usb/lan78xx.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3135,7 +3135,8 @@ static int lan78xx_open(struct net_device *net)
31353135
done:
31363136
mutex_unlock(&dev->dev_mutex);
31373137

3138-
usb_autopm_put_interface(dev->intf);
3138+
if (ret < 0)
3139+
usb_autopm_put_interface(dev->intf);
31393140

31403141
return ret;
31413142
}

0 commit comments

Comments
 (0)