On 04/10/20 3:05 am, Joe Perches wrote:
On Sun, 2020-10-04 at 02:49 +0530, Anant Thazhemadam wrote:
quoted
When get_registers() fails, in set_ethernet_addr(),the uninitialized
value of node_id gets copied as the address. This can be considered as
set_ethernet_addr() itself failing.
[]
quoted
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
[]
quoted
@@ -909,7 +914,10 @@ static int rtl8150_probe(struct usb_interface *intf,
goto out1;
}
fill_skb_pool(dev);
- set_ethernet_addr(dev);
+ if (!set_ethernet_addr(dev)) {
+ dev_err(&intf->dev, "assigining a random MAC address\n");
+ eth_hw_addr_random(dev->netdev);
4 things:
.
o Typo for assigning
Oh no. I'm sorry about that.
o Reverse the assignment and message to show the new random MAC
Ah, okay. That would be more informative.
o This should use netdev_<level>
Understood.
o Is this better as error or notification?
if (!set_ethernet_addr(dev)) {
eth_hw_addr_random(dev->netdev);
netdev_notice(dev->netdev, "Assigned a random MAC: %pM\n",
dev->netdev->dev_addr);
}
I thought it might be an error since set_ethernet_addr() did fail after
all. But making it info seems like a better idea, since technically speaking,
the device is still made accessible.
I'll wait for a day or two, to see if anybody else has any other comments,
and send in a v4 incorporating these changes.
Thanks,
Anant
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees