On Thu, 2014-10-02 at 16:26 +0800, Hayes Wang wrote: > Resume the device before setting the MAC address. > > Signed-off-by: Hayes Wang <hayeswang@xxxxxxxxxxx> > --- > drivers/net/usb/r8152.c | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c > index 604ef21..e823358 100644 > --- a/drivers/net/usb/r8152.c > +++ b/drivers/net/usb/r8152.c > @@ -1007,9 +1007,16 @@ static int rtl8152_set_mac_address(struct net_device *netdev, void *p) > { > struct r8152 *tp = netdev_priv(netdev); > struct sockaddr *addr = p; > + int ret; > + > + ret = usb_autopm_get_interface(tp->intf); > + if (ret < 0) > + goto out1; > > - if (!is_valid_ether_addr(addr->sa_data)) > - return -EADDRNOTAVAIL; It would be more legant to check validity before you do the pm operation. Error handling would be simpler. Regards Oliver -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html