public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: linux-wireless@vger.kernel.org
Cc: "Jeff Johnson" <jjohnson@kernel.org>,
	"Toke Høiland-Jørgensen" <toke@toke.dk>,
	"Brian Norris" <briannorris@chromium.org>,
	"Francesco Dolcini" <francesco@dolcini.it>,
	"Felix Fietkau" <nbd@nbd.name>,
	"Lorenzo Bianconi" <lorenzo@kernel.org>,
	"Ryder Lee" <ryder.lee@mediatek.com>,
	"Shayne Chen" <shayne.chen@mediatek.com>,
	"Sean Wang" <sean.wang@mediatek.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Stanislaw Gruszka" <stf_xl@wp.pl>,
	"Hin-Tak Leung" <hintak.leung@gmail.com>,
	"Jes Sorensen" <Jes.Sorensen@gmail.com>,
	"Ping-Ke Shih" <pkshih@realtek.com>,
	"Nicolas Ferre" <nicolas.ferre@microchip.com>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"Claudiu Beznea" <claudiu.beznea@tuxon.dev>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	libertas-dev@lists.infradead.org, linux-kernel@vger.kernel.org,
	"Johan Hovold" <johan@kernel.org>
Subject: [PATCH v2 13/18] wifi: mt76: mt792xu: drop redundant device reference
Date: Fri,  6 Mar 2026 09:51:39 +0100	[thread overview]
Message-ID: <20260306085144.12064-14-johan@kernel.org> (raw)
In-Reply-To: <20260306085144.12064-1-johan@kernel.org>

Driver core holds a reference to the USB interface and its parent USB
device while the interface is bound to a driver and there is no need to
take additional references unless the structures are 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>
---
 drivers/net/wireless/mediatek/mt76/mt7921/usb.c | 2 --
 drivers/net/wireless/mediatek/mt76/mt7925/usb.c | 2 --
 drivers/net/wireless/mediatek/mt76/mt792x_usb.c | 1 -
 3 files changed, 5 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/usb.c b/drivers/net/wireless/mediatek/mt76/mt7921/usb.c
index 17057e68bf21..9bfc234f306f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/usb.c
@@ -197,7 +197,6 @@ static int mt7921u_probe(struct usb_interface *usb_intf,
 	dev->fw_features = features;
 	dev->hif_ops = &hif_ops;
 
-	udev = usb_get_dev(udev);
 	usb_reset_device(udev);
 
 	usb_set_intfdata(usb_intf, dev);
@@ -246,7 +245,6 @@ static int mt7921u_probe(struct usb_interface *usb_intf,
 	mt76u_queues_deinit(&dev->mt76);
 
 	usb_set_intfdata(usb_intf, NULL);
-	usb_put_dev(interface_to_usbdev(usb_intf));
 
 	mt76_free_device(&dev->mt76);
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/usb.c b/drivers/net/wireless/mediatek/mt76/mt7925/usb.c
index d9968f03856d..84bcebbf009a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/usb.c
@@ -185,7 +185,6 @@ static int mt7925u_probe(struct usb_interface *usb_intf,
 	dev->fw_features = features;
 	dev->hif_ops = &hif_ops;
 
-	udev = usb_get_dev(udev);
 	usb_reset_device(udev);
 
 	usb_set_intfdata(usb_intf, dev);
@@ -234,7 +233,6 @@ static int mt7925u_probe(struct usb_interface *usb_intf,
 	mt76u_queues_deinit(&dev->mt76);
 
 	usb_set_intfdata(usb_intf, NULL);
-	usb_put_dev(interface_to_usbdev(usb_intf));
 
 	mt76_free_device(&dev->mt76);
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_usb.c b/drivers/net/wireless/mediatek/mt76/mt792x_usb.c
index 552808458138..f827e8a56a18 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x_usb.c
+++ b/drivers/net/wireless/mediatek/mt76/mt792x_usb.c
@@ -306,7 +306,6 @@ void mt792xu_disconnect(struct usb_interface *usb_intf)
 	mt792xu_cleanup(dev);
 
 	usb_set_intfdata(usb_intf, NULL);
-	usb_put_dev(interface_to_usbdev(usb_intf));
 
 	mt76_free_device(&dev->mt76);
 }
-- 
2.52.0


  parent reply	other threads:[~2026-03-06  8:52 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-06  8:51 [PATCH v2 00/18] wifi: drop redundant USB device references Johan Hovold
2026-03-06  8:51 ` [PATCH v2 01/18] wifi: ath6kl: drop redundant device reference Johan Hovold
2026-03-06  8:51 ` [PATCH v2 02/18] wifi: ath6kl: rename disconnect callback Johan Hovold
2026-03-06  8:51 ` [PATCH v2 03/18] wifi: ath9k: drop redundant device reference Johan Hovold
2026-03-09 11:45   ` Toke Høiland-Jørgensen
2026-03-06  8:51 ` [PATCH v2 04/18] wifi: ath10k: " Johan Hovold
2026-03-06  8:51 ` [PATCH v2 05/18] wifi: ath10k: rename disconnect callback Johan Hovold
2026-03-06  8:51 ` [PATCH v2 06/18] wifi: at76c50x: drop redundant device reference Johan Hovold
2026-03-06  8:51 ` [PATCH v2 07/18] wifi: libertas: " Johan Hovold
2026-03-06  8:51 ` [PATCH v2 08/18] wifi: libertas_tf: " Johan Hovold
2026-03-06  8:51 ` [PATCH v2 09/18] wifi: mwifiex: " Johan Hovold
2026-03-06  8:51 ` [PATCH v2 10/18] wifi: mt76: " Johan Hovold
2026-03-06  8:51 ` [PATCH v2 11/18] wifi: mt76x0u: " Johan Hovold
2026-03-06  8:51 ` [PATCH v2 12/18] wifi: mt76x2u: " Johan Hovold
2026-03-06  8:51 ` Johan Hovold [this message]
2026-03-06  8:51 ` [PATCH v2 14/18] wifi: mt7601u: " Johan Hovold
2026-03-06  8:51 ` [PATCH v2 15/18] wifi: rt2x00: " Johan Hovold
2026-03-06  8:51 ` [PATCH v2 16/18] wifi: rtl818x: " Johan Hovold
2026-03-16  6:02   ` Ping-Ke Shih
2026-03-06  8:51 ` [PATCH v2 17/18] wifi: rtl8xxxu: " Johan Hovold
2026-03-06  8:51 ` [PATCH v2 18/18] wifi: rtw88: fix device leak on probe failure Johan Hovold
2026-03-06 21:39 ` [PATCH v2 00/18] wifi: drop redundant USB device references Jeff Johnson
2026-03-09  6:27   ` Johannes Berg
2026-03-09 14:25     ` Jeff Johnson
2026-03-10 15:31 ` (subset) " Jeff Johnson
2026-03-24  8:31 ` Johan Hovold
2026-03-24  8:40   ` Ping-Ke Shih
2026-03-24  8:45     ` Johan Hovold

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=20260306085144.12064-14-johan@kernel.org \
    --to=johan@kernel.org \
    --cc=Jes.Sorensen@gmail.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=briannorris@chromium.org \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=francesco@dolcini.it \
    --cc=gregkh@linuxfoundation.org \
    --cc=hintak.leung@gmail.com \
    --cc=jjohnson@kernel.org \
    --cc=kuba@kernel.org \
    --cc=libertas-dev@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=nicolas.ferre@microchip.com \
    --cc=pkshih@realtek.com \
    --cc=ryder.lee@mediatek.com \
    --cc=sean.wang@mediatek.com \
    --cc=shayne.chen@mediatek.com \
    --cc=stf_xl@wp.pl \
    --cc=toke@toke.dk \
    /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