From: "Tobias Waldekranz" <tobias@waldekranz.com>
To: "Greg KH" <gregkh@linuxfoundation.org>
Cc: <davem@davemloft.net>, <netdev@vger.kernel.org>, <andrew@lunn.ch>,
<f.fainelli@gmail.com>, <hkallweit1@gmail.com>,
<linux-usb@vger.kernel.org>
Subject: Re: [PATCH v3 2/2] net: phy: add marvell usb to mdio controller
Date: Sun, 22 Mar 2020 10:09:28 +0100 [thread overview]
Message-ID: <C1H8VLGMUEEC.3BCHVI0HO90KD@wkz-x280> (raw)
In-Reply-To: <20200322074006.GB64528@kroah.com>
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
Thanks
next prev parent reply other threads:[~2020-03-22 9:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-21 20:24 [PATCH v3 1/2] dt-bindings: net: add marvell usb to mdio bindings Tobias Waldekranz
2020-03-21 20:24 ` [PATCH v3 2/2] net: phy: add marvell usb to mdio controller Tobias Waldekranz
2020-03-22 7:40 ` Greg KH
2020-03-22 9:09 ` Tobias Waldekranz [this message]
2020-03-22 11:10 ` Greg KH
2020-03-22 13:32 ` Andrew Lunn
2020-03-22 21:10 ` Florian Fainelli
2020-03-22 13:33 ` [PATCH v3 1/2] dt-bindings: net: add marvell usb to mdio bindings Andrew Lunn
2020-03-22 13:35 ` Andrew Lunn
2020-03-22 14:38 ` Tobias Waldekranz
2020-03-22 21:03 ` Florian Fainelli
2020-03-30 15:11 ` Rob Herring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=C1H8VLGMUEEC.3BCHVI0HO90KD@wkz-x280 \
--to=tobias@waldekranz.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hkallweit1@gmail.com \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox