[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200322111051.GB72939@kroah.com>
Date: Sun, 22 Mar 2020 12:10:51 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Tobias Waldekranz <tobias@...dekranz.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org, andrew@...n.ch,
f.fainelli@...il.com, hkallweit1@...il.com,
linux-usb@...r.kernel.org
Subject: Re: [PATCH v3 2/2] net: phy: add marvell usb to mdio controller
On Sun, Mar 22, 2020 at 10:09:28AM +0100, Tobias Waldekranz wrote:
> 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.
>
> > > +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.
>
> > > + 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
Ok, just wanted to make sure :)
Reviewed-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Powered by blists - more mailing lists