Messages in this thread | | | Date | Mon, 21 Sep 2020 18:25:38 -0700 | From | Matthias Kaehlcke <> | Subject | Re: [PATCH v2 2/2] USB: misc: Add onboard_usb_hub driver |
| |
On Mon, Sep 21, 2020 at 09:08:12PM -0400, Alan Stern wrote: > On Mon, Sep 21, 2020 at 05:41:58PM -0700, Matthias Kaehlcke wrote: > > > > + put_device(hub->dev); > > > > > > Is there a matching get_device somewhere (like in _find_onboard_hub)? > > > If so, I didn't see it. And I don't see any reason for it. > > > > Yes, implicitly, of_find_device_by_node() "takes a reference to the > > embedded struct device which needs to be dropped after use." > > Okay. In that case it probably would be better to do the put_device() > right away, at the end of _find_onboard_hub().
ok
> There would be no danger of the platform device getting freed too soon > if you make onboard_hub_remove unbind the associated USB hub devices.
Yes, I'll add the unbinding as you suggested earlier
> But there would still be a danger of those devices somehow getting > rebound again at the wrong time; this suggests that you should add a > flag to the onboard_hub structure saying that the platform device is > about to go away.
Indeed, we want to avoid that. I'll add a flag to the struct as you suggested.
| |