Re: [PATCH v2 2/2] USB: misc: Add onboard_usb_hub driver
From: Matthias Kaehlcke
Date: Wed Sep 23 2020 - 18:25:50 EST
On Mon, Sep 21, 2020 at 06:18:37PM -0700, Matthias Kaehlcke wrote:
> On Sun, Sep 20, 2020 at 04:17:20PM +0200, Greg Kroah-Hartman wrote:
> > On Thu, Sep 17, 2020 at 11:46:22AM -0700, Matthias Kaehlcke wrote:
> > >
> > > ...
> > >
> > > +static int __init onboard_hub_init(void)
> > > +{
> > > + int rc;
> > > +
> > > + rc = platform_driver_register(&onboard_hub_driver);
> > > + if (rc)
> > > + return rc;
> > > +
> > > + return usb_register_device_driver(&onboard_hub_usbdev_driver, THIS_MODULE);
> >
> > No unwinding of the platform driver register if this fails?
>
> Right, will add unwinding.
>
> > And THIS_MODULE should not be needed, did we get the api wrong here?
>
> It seems you suggest to use usb_register() instead, SGTM
Actually usb_register() is for registering a struct usb_driver, however
this is a struct usb_device_driver, there doesn't seem to be a
registration function/macro that doesn't require THIS_MODULE. Please
provide a pointer if I'm wrong.