RE: [PATCH v1] usb: dwc3: add device put function to decrement the ref-counted reference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Thinh Nguyen <Thinh.Nguyen@xxxxxxxxxxxx>
> Sent: Friday, November 10, 2023 10:34 AM
> To: Stanley Chang[昌育德] <stanley_chang@xxxxxxxxxxx>
> Cc: Thinh Nguyen <Thinh.Nguyen@xxxxxxxxxxxx>; Christophe JAILLET
> <christophe.jaillet@xxxxxxxxxx>; Greg Kroah-Hartman
> <gregkh@xxxxxxxxxxxxxxxxxxx>; linux-usb@xxxxxxxxxxxxxxx;
> linux-kernel@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH v1] usb: dwc3: add device put function to decrement the
> ref-counted reference
> 
> 
> External mail.
> 
> 
> 
> On Tue, Nov 07, 2023, Stanley Chang wrote:
> > When the function exits, the count should be decremented via
> > platform_device_put and of_node_put.
> >
> > Fixes: 34c200483569 ("usb: dwc3: add Realtek DHC RTD SoC dwc3 glue
> > layer driver")
> > Signed-off-by: Stanley Chang <stanley_chang@xxxxxxxxxxx>
> > ---
> >  drivers/usb/dwc3/dwc3-rtk.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/usb/dwc3/dwc3-rtk.c b/drivers/usb/dwc3/dwc3-rtk.c
> > index 590028e8fdcb..9d6f2a8bd6ce 100644
> > --- a/drivers/usb/dwc3/dwc3-rtk.c
> > +++ b/drivers/usb/dwc3/dwc3-rtk.c
> > @@ -187,6 +187,7 @@ static enum usb_device_speed
> > __get_dwc3_maximum_speed(struct device_node *np)
> >
> >       ret = match_string(speed_names, ARRAY_SIZE(speed_names),
> > maximum_speed);
> >
> > +     of_node_put(dwc3_np);
> >       return (ret < 0) ? USB_SPEED_UNKNOWN : ret;  }
> >
> > @@ -339,6 +340,8 @@ static int dwc3_rtk_probe_dwc3_core(struct
> > dwc3_rtk *rtk)
> >
> >       switch_usb2_role(rtk, rtk->cur_role);
> >
> > +     platform_device_put(dwc3_pdev);
> 
> Don't you use this after probe? Why put here and not on remove?

I don't use dwc3_pdev in driver.
I use rtk->dwc and dwc is removed by of_platform_depopulate on remove.
So I think I don't need to keep the count of dwc3_pdev.

Thanks,
Stanley

> 
> BR,
> Thinh
> 
> > +     of_node_put(dwc3_node);
> >       return 0;
> >
> >  err_pdev_put:
> > --
> > 2.34.1
> >




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux