On Sun Mar 22, 2020 at 8:40 AM, Greg KH wrote:
From a USB point of view, it looks sane, only one question:
Great, thanks for the review.
quoted
+static int mvusb_mdio_probe(struct usb_interface *interface,
+ const struct usb_device_id *id)
+{
+ struct device *dev = &interface->dev;
+ struct mvusb_mdio *mvusb;
+ struct mii_bus *mdio;
+
+ mdio = devm_mdiobus_alloc_size(dev, sizeof(*mvusb));
You allocate a bigger buffer here than the original pointer thinks it is
pointing to?
Yes. I've seen this pattern in a couple of places in the kernel,
e.g. alloc_netdev also does this. The object is extended with the
requested size, and the offset is stored somewhere for later use by
the driver.
quoted
+ if (!mdio)
+ return -ENOMEM;
+
+ mvusb = mdio->priv;
And then you set this pointer here?
...in this case in the priv member.
https://code.woboq.org/linux/linux/drivers/net/phy/mdio_bus.c.html#143
Thanks