From nobody Thu Apr 9 23:23:27 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B6FA382360; Thu, 5 Mar 2026 10:39:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772707169; cv=none; b=oNeZ0lohIDIbs7BEw00X1W7updebMoB8ZAf+X8bSyW5iqQagaZanThvCDFTDUrS26R5/SFRCM0mVqSRFa3qqRjJXVSc76I3pXPI8RQPrTZPbKqeeL1KNGAK1vCJo8GUqwS5F8Mme4jImOb9GKlO6JN9AcaI+9PNTTtNCBB0JyXU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772707169; c=relaxed/simple; bh=iHepo1Ohl1x8M46tJxVZJc4lcSZlaOA5mD8tdAIuhxg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZUdtU7pICdFPv2ONrRksNl85eKP1pVFFIJXDmDXVIas9+MGYJetrE2dSvoJyBqLnCVcEMY4jAZvkgLY3e58OraMqXIPXcxypn743AK+skyvpPLh3BndDnJIMTyILuUgXTUa9SiRf86xitRz8xuNjNFm1uAPuc1qLdVgLHngQ1z4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eev+W6LC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eev+W6LC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 277B9C2BCB0; Thu, 5 Mar 2026 10:39:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772707169; bh=iHepo1Ohl1x8M46tJxVZJc4lcSZlaOA5mD8tdAIuhxg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eev+W6LCV0uSfv785AaWz41fUjMC659NfvdWfoPBe0bRS3Wk7LMgYWFtzbXxF/NKQ NnQvHS6UzaeHO/Y23DhygnWucu+Ma77d+Dw4wHClJoeDacTbG1LuGBSdX82PDLdO5k Ja8khRSVE1Xf3vZ1s6qA3XVUFvyYVvBHx98JqQ7x+gmAR+fPWxDswCC4S6cKKPkaUd cKqzDwJjF8+Ug57vjNR+UwIjrno/EncT2/pDO0fa6b8/YoSfwjhPQ04lr+5YDaCWhP BT97eSRG81ZBy2k44mkcAFdjIFLeZu2i0m8cby0vDvizZEpm40oTlxQNBDM6k7GUmZ GYMr1UazoLlxA== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vy674-0000000043Q-3dGC; Thu, 05 Mar 2026 11:39:26 +0100 From: Johan Hovold To: Sean Young , Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 1/4] media: imon: drop redundant device references Date: Thu, 5 Mar 2026 11:39:16 +0100 Message-ID: <20260305103919.15560-2-johan@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260305103919.15560-1-johan@kernel.org> References: <20260305103919.15560-1-johan@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 references to reduce cargo culting, make it easier to spot drivers where extra references are needed, and reduce the risk of memory leaks when drivers fail to release them. Signed-off-by: Johan Hovold --- drivers/media/rc/imon.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 7e92161105d5..ecea0085d411 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -2250,7 +2250,7 @@ static struct imon_context *imon_init_intf0(struct us= b_interface *intf, mutex_lock(&ictx->lock); =20 ictx->dev =3D dev; - ictx->usbdev_intf0 =3D usb_get_dev(interface_to_usbdev(intf)); + ictx->usbdev_intf0 =3D interface_to_usbdev(intf); ictx->rx_urb_intf0 =3D rx_urb; ictx->tx_urb =3D tx_urb; ictx->rf_device =3D false; @@ -2308,7 +2308,6 @@ static struct imon_context *imon_init_intf0(struct us= b_interface *intf, usb_kill_urb(ictx->rx_urb_intf0); urb_submit_failed: find_endpoint_failed: - usb_put_dev(ictx->usbdev_intf0); mutex_unlock(&ictx->lock); usb_free_urb(tx_urb); tx_urb_alloc_failed: @@ -2338,7 +2337,7 @@ static struct imon_context *imon_init_intf1(struct us= b_interface *intf, timer_setup(&ictx->ttimer, imon_touch_display_timeout, 0); } =20 - ictx->usbdev_intf1 =3D usb_get_dev(interface_to_usbdev(intf)); + ictx->usbdev_intf1 =3D interface_to_usbdev(intf); ictx->rx_urb_intf1 =3D rx_urb; =20 ret =3D -ENODEV; @@ -2377,7 +2376,6 @@ static struct imon_context *imon_init_intf1(struct us= b_interface *intf, input_unregister_device(ictx->touch); touch_setup_failed: find_endpoint_failed: - usb_put_dev(ictx->usbdev_intf1); ictx->usbdev_intf1 =3D NULL; mutex_unlock(&ictx->lock); usb_free_urb(rx_urb); @@ -2426,7 +2424,7 @@ static int imon_probe(struct usb_interface *interface, struct imon_context *ictx =3D NULL; u16 vendor, product; =20 - usbdev =3D usb_get_dev(interface_to_usbdev(interface)); + usbdev =3D interface_to_usbdev(interface); iface_desc =3D interface->cur_altsetting; ifnum =3D iface_desc->desc.bInterfaceNumber; vendor =3D le16_to_cpu(usbdev->descriptor.idVendor); @@ -2495,12 +2493,9 @@ static int imon_probe(struct usb_interface *interfac= e, vendor, product, ifnum, usbdev->bus->busnum, usbdev->devnum); =20 - usb_put_dev(usbdev); - return 0; =20 fail: - usb_put_dev(usbdev); dev_err(dev, "unable to register, err %d\n", ret); =20 return ret; @@ -2550,7 +2545,6 @@ static void imon_disconnect(struct usb_interface *int= erface) else if (ictx->display_type =3D=3D IMON_DISPLAY_TYPE_VFD) usb_deregister_dev(interface, &imon_vfd_class); } - usb_put_dev(ictx->usbdev_intf0); } else { ictx->dev_present_intf1 =3D false; usb_kill_urb(ictx->rx_urb_intf1); @@ -2558,7 +2552,6 @@ static void imon_disconnect(struct usb_interface *int= erface) timer_delete_sync(&ictx->ttimer); input_unregister_device(ictx->touch); } - usb_put_dev(ictx->usbdev_intf1); } =20 if (refcount_dec_and_test(&ictx->users)) --=20 2.52.0 From nobody Thu Apr 9 23:23:27 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B695382368; Thu, 5 Mar 2026 10:39:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772707169; cv=none; b=dzOtx5bsgUloSzq/8SEaY/fE//EBXqyogZDpAt5Sq1ic1qz6C9/CQ1hARuCI/8963RE287Wg6LP/zjaLDFjKkSbFK9xFbrnHlAzRP9ShDpsPj0QvR1qe+zH8Z2jx4TKiqqkpcKbSze3Kl1g4CdWWTtaI/d6OiT7FyMEUevX5PvI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772707169; c=relaxed/simple; bh=2IMZSnX3bItCAbNT5Kf1ig5Bae8qoO7U3f/Fz8jyTME=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=peOSjnZW32v00CawXATjLAQSNius7BDVX0TcbPSdJrVVAaHlWrw7RFpMjeas/TjbfU64xgAbmlaNLr9svIxhZwKeXshAgHxP11ip8i727/kj6lvge2aL7muaEbEhQC6x4UAOlLzYsRWJOGqpWvAqrwHX+9kHk41ojLqJ220mDFc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UyC5b2aS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UyC5b2aS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54158C2BCAF; Thu, 5 Mar 2026 10:39:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772707169; bh=2IMZSnX3bItCAbNT5Kf1ig5Bae8qoO7U3f/Fz8jyTME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UyC5b2aSIpNRUAWUqpTKvnXcWNHM8Qu5Bv/mOrYIW6UCUUnrvvQIXHKC8ONgQVed5 kk0/IAOKGeDlH6gaMAO6ffKOVKVEsxpo8TQDi2gX7eh83oYazHFrP/nf53vRwFu/a6 mqrq1uf/Dy60c8cIn/Cfli4jP10dxgDasP2Yi0fX+eNRDwJD4sVaFl+txKKZjlunp8 gNlREtzDey4o78nV6ylGI8Fd9TLLtNOP6e0ZkVHmbohOUxdknKCWM73NplMAnkHGAD pSiumtuujTP1dk5vQS6E6sZ7484ede0oBRCGosXoPnPVvEzJbDb7iLzYuXdOyl+yUI kUpmqVZP5I7Pw== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vy674-0000000043S-3fvU; Thu, 05 Mar 2026 11:39:26 +0100 From: Johan Hovold To: Sean Young , Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 2/4] media: mceusb: drop redundant device reference Date: Thu, 5 Mar 2026 11:39:17 +0100 Message-ID: <20260305103919.15560-3-johan@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260305103919.15560-1-johan@kernel.org> References: <20260305103919.15560-1-johan@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/media/rc/mceusb.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c index ed55e9ec3c57..d9bdf0b9487a 100644 --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c @@ -1729,7 +1729,7 @@ static int mceusb_dev_probe(struct usb_interface *int= f, goto urb_in_alloc_fail; =20 ir->usbintf =3D intf; - ir->usbdev =3D usb_get_dev(dev); + ir->usbdev =3D dev; ir->dev =3D &intf->dev; ir->len_in =3D maxp; ir->flags.microsoft_gen1 =3D is_microsoft_gen1; @@ -1817,7 +1817,6 @@ static int mceusb_dev_probe(struct usb_interface *int= f, /* Error-handling path */ rc_dev_fail: cancel_work_sync(&ir->kevent); - usb_put_dev(ir->usbdev); usb_kill_urb(ir->urb_in); usb_free_urb(ir->urb_in); urb_in_alloc_fail: @@ -1849,7 +1848,6 @@ static void mceusb_dev_disconnect(struct usb_interfac= e *intf) usb_kill_urb(ir->urb_in); usb_free_urb(ir->urb_in); usb_free_coherent(dev, ir->len_in, ir->buf_in, ir->dma_in); - usb_put_dev(dev); =20 kfree(ir); } --=20 2.52.0 From nobody Thu Apr 9 23:23:27 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6575C37D13A; Thu, 5 Mar 2026 10:39:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772707169; cv=none; b=hmivW+oJ+bGNzQknIJcIrbxHPV1VqAXCutYqsgphtqCjGRHyeB5QTF4vM9+Yr0WeVY2SIqCCbkOuODNFJJ5X0pn4/MEDSITup/Ij185RxcroxUArWzbT8ZjwMaV1Tag08SZXn/vbRlpsn38C21+CSqq5IyZNlvUcgoTmrGPxmoE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772707169; c=relaxed/simple; bh=bdMXs3cKCsinjxiW7C7KKB3lLvMOBVAZch5dXGPzlBM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Oc/BI1/0BLL3ESmcOifS3Tvvmo1NGDnHoWZtOUpY60RwQ9XV7cTxGqTog6ZRmUJ/xdHdVwfwKOw/EIg49YuXcHlO+wXDjX12W/fJH2NZyYsm0GLR+PbqAN9tQb+VkU5uIsy56ucitUeA2NviLwOpqgsvX7QximxEGG62H+6TMB8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=L7cwBBHz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="L7cwBBHz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D611C4AF0B; Thu, 5 Mar 2026 10:39:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772707169; bh=bdMXs3cKCsinjxiW7C7KKB3lLvMOBVAZch5dXGPzlBM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L7cwBBHzcHKKwixohDAmXlENn32IwCK74hwBObabRGT7axxvtdWVBGlLkcMPEUscm z1/wROdmWBc++Bl8RTStxd6Uha09eIMAjyQEQX4ziTXKaDxYmXd6+GxMMLfeGq4NTr /VPBw1ONDHpVj9HIU9+xu0dszvl3HYPX4trFXga12caxdV1SvGRwvHYGXlflswob9B voCsdvkz9L1yPe4YSGY8wYJAwZ1V5WzTuoBiR6UGQ0BMsgEyzYE0owJcbjpu1ACcxB /f2KsTo3K+PKNnimWlx7QDcHaBOuHTTa1+dq7tlQ23S/zthD3ig6Z6dPQ+w67wxknM Ou0tWlwB+8u5g== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vy674-0000000043U-3iYQ; Thu, 05 Mar 2026 11:39:26 +0100 From: Johan Hovold To: Sean Young , Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 3/4] media: go7007-loader: drop redundant device reference Date: Thu, 5 Mar 2026 11:39:18 +0100 Message-ID: <20260305103919.15560-4-johan@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260305103919.15560-1-johan@kernel.org> References: <20260305103919.15560-1-johan@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/media/usb/go7007/go7007-loader.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/media/usb/go7007/go7007-loader.c b/drivers/media/usb/g= o7007/go7007-loader.c index 243aa0ad074c..5747e6e4f2d6 100644 --- a/drivers/media/usb/go7007/go7007-loader.c +++ b/drivers/media/usb/go7007/go7007-loader.c @@ -41,9 +41,7 @@ static int go7007_loader_probe(struct usb_interface *inte= rface, int ret; int i; =20 - usbdev =3D usb_get_dev(interface_to_usbdev(interface)); - if (!usbdev) - goto failed2; + usbdev =3D interface_to_usbdev(interface); =20 if (usbdev->descriptor.bNumConfigurations !=3D 1) { dev_err(&interface->dev, "can't handle multiple config\n"); @@ -96,7 +94,6 @@ static int go7007_loader_probe(struct usb_interface *inte= rface, return 0; =20 failed2: - usb_put_dev(usbdev); dev_err(&interface->dev, "probe failed\n"); return -ENODEV; } @@ -104,7 +101,6 @@ static int go7007_loader_probe(struct usb_interface *in= terface, static void go7007_loader_disconnect(struct usb_interface *interface) { dev_info(&interface->dev, "disconnect\n"); - usb_put_dev(interface_to_usbdev(interface)); usb_set_intfdata(interface, NULL); } =20 --=20 2.52.0 From nobody Thu Apr 9 23:23:27 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 67E883822B8; Thu, 5 Mar 2026 10:39:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772707169; cv=none; b=uysH34/CNEzpDw5vDSYmclSIFuBfD7XOWfetw93SscB+JSj2VEhGfgaOl/4w6fRe0JQXwiarb8hpp3UBE3ngSGTQ3UD8qgF8IfFy5dr3j/W3PKV6b457Er+JjwAqU6HpFJ2EuAoG7JxrHGdUZUqgPbCcFYsV+DwKupEvONRoakI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772707169; c=relaxed/simple; bh=EeRpCxsAC/o0jMyKqonVxgwDWTMQxm9zIGP37W8BowQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kW7J4XbKzadQzeIntOzk51PXFAyh1VGwm/BbJLNUOPfj+ARCRkcXYzP9cqAjJ+9MxoFDxP4rLKSPm1GjOHnrwSrKwKFDjc3hxXQvJIA9bMPsZjBgKB6oiEYRAzSUNYMOyo6th/z6MqMObK/HdjY0CmcsTi4W6WNJr0BhpyZaEYc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=i/hWoUk/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="i/hWoUk/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06C1DC19422; Thu, 5 Mar 2026 10:39:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772707169; bh=EeRpCxsAC/o0jMyKqonVxgwDWTMQxm9zIGP37W8BowQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i/hWoUk/BUAeZY5cxfUm7C1IzlhcaXiyTMXVSi4WqWm0g/C8tI5gNU8SJg6pXli2E X+Js6IYxHwIjq8ITofICj9KX+bUjkLMeRn77oj6fcIBjdg/bK0EGTTrMf5wR07Ik+q SLRY6rA+o/VTY02cgET+MXN+zYoNrMsOEvAgioBYiE8Atp1uCfnZp4OPZUhE9VrYg9 C8rHKgpJoB3k10BME1xicne/QuNv95O4CeO9GLcLhpf+XN7YllqOmAGOXWxUgScGfh MDbebEenKtT/5dIHt+bs11We9M2WnS7orN1+wkZdhH7Q/pckigXWTrqM+ziOuH2gQ1 5yhBfxXSoOgLQ== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vy674-0000000043W-3lTs; Thu, 05 Mar 2026 11:39:26 +0100 From: Johan Hovold To: Sean Young , Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 4/4] media: usbtv: drop redundant device reference Date: Thu, 5 Mar 2026 11:39:19 +0100 Message-ID: <20260305103919.15560-5-johan@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260305103919.15560-1-johan@kernel.org> References: <20260305103919.15560-1-johan@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/media/usb/usbtv/usbtv-core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/usb/usbtv/usbtv-core.c b/drivers/media/usb/usbtv= /usbtv-core.c index c4bfadbe63c9..6c4facf4f41a 100644 --- a/drivers/media/usb/usbtv/usbtv-core.c +++ b/drivers/media/usb/usbtv/usbtv-core.c @@ -91,7 +91,7 @@ static int usbtv_probe(struct usb_interface *intf, if (usbtv =3D=3D NULL) return -ENOMEM; usbtv->dev =3D dev; - usbtv->udev =3D usb_get_dev(interface_to_usbdev(intf)); + usbtv->udev =3D interface_to_usbdev(intf); =20 usbtv->iso_size =3D size; =20 @@ -119,7 +119,6 @@ static int usbtv_probe(struct usb_interface *intf, =20 usbtv_video_fail: usb_set_intfdata(intf, NULL); - usb_put_dev(usbtv->udev); kfree(usbtv); =20 return ret; @@ -137,7 +136,6 @@ static void usbtv_disconnect(struct usb_interface *intf) usbtv_audio_free(usbtv); usbtv_video_free(usbtv); =20 - usb_put_dev(usbtv->udev); usbtv->udev =3D NULL; =20 /* the usbtv structure will be deallocated when v4l2 will be --=20 2.52.0