mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bastien Nocera <hadess@hadess.net>
To: Johan Hovold <johan@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Valentina Manea <valentina.manea.m@gmail.com>,
	Shuah Khan <shuah@kernel.org>,  Hongren Zheng	 <i@zenithal.me>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] USB: apple-mfi-fastcharge: drop redundant device reference
Date: Tue, 10 Mar 2026 15:38:30 +0100	[thread overview]
Message-ID: <1a459d29a8837059fb75cd64d311424497828aee.camel@hadess.net> (raw)
In-Reply-To: <20260305133851.2952-2-johan@kernel.org>

On Thu, 2026-03-05 at 14:38 +0100, Johan Hovold wrote:
> Driver core holds a reference to the USB device while it is bound to
> a
> driver and there is no need to take additional references unless the
> structure is needed after disconnect.
> 
> Drop the redundant device reference to reduce cargo culting, make it
> easier to spot drivers where an extra reference is needed, and reduce
> the risk of memory leaks when drivers fail to release it.
> 
> Signed-off-by: Johan Hovold <johan@kernel.org>

Reviewed-by: Bastien Nocera <hadess@hadess.net>

> ---
>  drivers/usb/misc/apple-mfi-fastcharge.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/misc/apple-mfi-fastcharge.c
> b/drivers/usb/misc/apple-mfi-fastcharge.c
> index 339f6cd2e9b2..af266e19f2fd 100644
> --- a/drivers/usb/misc/apple-mfi-fastcharge.c
> +++ b/drivers/usb/misc/apple-mfi-fastcharge.c
> @@ -210,7 +210,7 @@ static int mfi_fc_probe(struct usb_device *udev)
>  		goto err_free_name;
>  	}
>  
> -	mfi->udev = usb_get_dev(udev);
> +	mfi->udev = udev;
>  	dev_set_drvdata(&udev->dev, mfi);
>  
>  	return 0;
> @@ -231,7 +231,6 @@ static void mfi_fc_disconnect(struct usb_device
> *udev)
>  		power_supply_unregister(mfi->battery);
>  	kfree(mfi->battery_desc.name);
>  	dev_set_drvdata(&udev->dev, NULL);
> -	usb_put_dev(mfi->udev);
>  	kfree(mfi);
>  }
>  

  reply	other threads:[~2026-03-10 14:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-05 13:38 [PATCH 0/2] USB: drop further redundant device references Johan Hovold
2026-03-05 13:38 ` [PATCH 1/2] USB: apple-mfi-fastcharge: drop redundant device reference Johan Hovold
2026-03-10 14:38   ` Bastien Nocera [this message]
2026-03-05 13:38 ` [PATCH 2/2] USB: usbip: " Johan Hovold
2026-03-09 20:26   ` Shuah Khan
2026-03-10  8:35     ` Johan Hovold
2026-03-10 21:51       ` Shuah Khan
2026-03-11  8:02         ` Johan Hovold
2026-03-23 19:29           ` Shuah Khan

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=1a459d29a8837059fb75cd64d311424497828aee.camel@hadess.net \
    --to=hadess@hadess.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=i@zenithal.me \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=valentina.manea.m@gmail.com \
    /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

Powered by JetHome