Re: [PATCH] usb: dwc3: gadget: clear gadget pointer after exit

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

 



On Thu, Sep 09, 2021 at 01:45:47PM +0800, Linyu Yuan wrote:
> change device release function to clear gadget pointer.

That does not properly describe what and why this change is needed.

> 
> Signed-off-by: Linyu Yuan <quic_linyyuan@xxxxxxxxxxx>
> ---
>  drivers/usb/dwc3/gadget.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 804b505..e2ab5f6 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -4188,9 +4188,10 @@ static int dwc3_gadget_get_irq(struct dwc3 *dwc)
>  
>  static void dwc_gadget_release(struct device *dev)
>  {
> -	struct usb_gadget *gadget = container_of(dev, struct usb_gadget, dev);
> +	struct dwc3 *dwc = dev_get_platdata(dev);

Are you sure this is the same?

>  
> -	kfree(gadget);
> +	kfree(dwc->gadget);
> +	dwc->gadget = NULL;

Why set this to NULL?  Who cares about this now?  What changed to make
it required?

thanks,

greg k-h



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

  Powered by Linux