From nobody Thu Apr 9 21:49:53 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 6006738642F; Thu, 5 Mar 2026 11:15:28 +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=1772709328; cv=none; b=SzSU93PgA33ivZ6ZZSUprm9/81XOJ0szuBms4y6PyrlNcJvHd21nIgw0DBuZ3fix7IkVj9xwu0i3bMvEOgvy5jAwJ7vCjVI7ISreU4AzaZOcZ6ZbcLCa3XsSum2yMENpVMKLh66KojG0Egfte8Pzr/JMoD6MrJfFgbc/9ZfivRI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772709328; c=relaxed/simple; bh=hGq0+CM200unysQdJAyOZo6M3b9G1AjRQPl31InwpJw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jCUs5ZxqieVbC+mQRomu17e4SPDIWvPxTSbcPRiU78oG/3vsfKuWiUaLSTTmzqEd+/MSV3+81zo94NlAkA1pq16J/A03/8Xj2YgWzxfxFK7RDEGeX32fDoPpYX41GXYGW6h2fjy5d6hgDg0mgKIPT+YgmgpkAxxO/DNfyVFWbvs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EuCYM3Le; 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="EuCYM3Le" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10510C2BCAF; Thu, 5 Mar 2026 11:15:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772709328; bh=hGq0+CM200unysQdJAyOZo6M3b9G1AjRQPl31InwpJw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EuCYM3Le5f0YUBWsPJ86WUx8jv/W1aLzD5iFbpHizrClP8/S/zrKC76bJCpRWFC0a DsKr1OH77PEsSuV+dGtOJUiS3hqAGlQAJ7bQMLTZqyYOZ8GyMfWFVp74x/nEVS0j4K SFErcwR5ru557L6T7r8cBUaoX70RdLstc/BRyZBvTYqT1DFYb377EqHV4uHJQoyJj5 WkCFOFsH34TNlYIOfRzlOGsmmB2Vd90HZDSZvch3Wa+lvAbVxcfVckSUOmzM3u5UYm TnGCDkS3ICugOEY6hJtWTrjF8HdltnRMkFH5kNpKikmHqquf2epKRQfm/X3Oufz4w0 seAw90+TTAy8w== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vy6ft-000000004nd-3lOW; Thu, 05 Mar 2026 12:15:25 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Lixu Zhang , Sakari Ailus , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 1/5] USB: cypress_cy7c63: drop redundant device reference Date: Thu, 5 Mar 2026 12:15:07 +0100 Message-ID: <20260305111511.18386-2-johan@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260305111511.18386-1-johan@kernel.org> References: <20260305111511.18386-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/usb/misc/cypress_cy7c63.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/misc/cypress_cy7c63.c b/drivers/usb/misc/cypress_c= y7c63.c index 99185fc3e9df..4a7f955ba85b 100644 --- a/drivers/usb/misc/cypress_cy7c63.c +++ b/drivers/usb/misc/cypress_cy7c63.c @@ -215,7 +215,7 @@ static int cypress_probe(struct usb_interface *interfac= e, if (!dev) goto error_mem; =20 - dev->udev =3D usb_get_dev(interface_to_usbdev(interface)); + dev->udev =3D interface_to_usbdev(interface); =20 /* save our data pointer in this interface device */ usb_set_intfdata(interface, dev); @@ -239,8 +239,6 @@ static void cypress_disconnect(struct usb_interface *in= terface) * device files have been removed */ usb_set_intfdata(interface, NULL); =20 - usb_put_dev(dev->udev); - dev_info(&interface->dev, "Cypress CY7C63xxx device now disconnected\n"); =20 --=20 2.52.0 From nobody Thu Apr 9 21:49:53 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 5FFC8385536; Thu, 5 Mar 2026 11:15:28 +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=1772709328; cv=none; b=gCA7NIeUnYWke6Ll7IEQ4BupvknrPAeUjIxs0MNbA0yjHeLjrCm2ZfE+VFX/Dl3+tspB5eyfG1Z+1txC8eYt1vc3VncGcOI1LZONoVpFkmh6/qYcDR6NCSSsUHnT+itHTCrBD8VdAcyHT/jLxFk+KNlZjV+LczEZgtmMULNL+X0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772709328; c=relaxed/simple; bh=LHTW92pouoy0ryE6AcSXfrvIRL/W8q7FUWuga+ffaF0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RKWxQs7+AAW7TKh3g3itikVue0os/mzS8yk2qYnYb0/tgynzIqfd1GFV4mi2ffnpQ7vcx7GzUP1PyNK+5BaJswGKDaNsh23bqQbK63606QVpDNexz9qSgJXBDySXAhndIsNHDxjk3WyTvc40IHw26xXh58Zh3kL74VT5xxOpDZk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NYjST4up; 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="NYjST4up" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0ADA5C19423; Thu, 5 Mar 2026 11:15:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772709328; bh=LHTW92pouoy0ryE6AcSXfrvIRL/W8q7FUWuga+ffaF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NYjST4upKGCaQ6j7GAPkO0fgJAlvnfWbKdPM0k0qU8XPUhT1uMgBg1/qoK/8/Mye1 z1WDJSxoRQykGiIWzgFUvj4evhfhAQo2ddwcDOyPn7MwBfjDh8OBLRKtd/JkBVoqpX azijyC2ntOZ50f5anboHRPKbOATm+A9D9h2td9h/hn+A2elSam4dvufIyZ85Lr4Agn xN0v6uYQ/jJ+JOeX9R8BBpiip78lSCGMb7v0E+BbGdVxtqKADuzJUSRH7HXo6NvpMU va/tboUwV0oQ9kdqdR8urA7ha7wS2vsi1Rq1R3w8pMR+SIwf0stlLIjjonyLV+RswI 6oUH+1RdHGySw== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vy6ft-000000004ng-3oJO; Thu, 05 Mar 2026 12:15:25 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Lixu Zhang , Sakari Ailus , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 2/5] USB: cytherm: drop redundant device reference Date: Thu, 5 Mar 2026 12:15:08 +0100 Message-ID: <20260305111511.18386-3-johan@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260305111511.18386-1-johan@kernel.org> References: <20260305111511.18386-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/usb/misc/cytherm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/misc/cytherm.c b/drivers/usb/misc/cytherm.c index 2bf082474e9d..b183df9826bc 100644 --- a/drivers/usb/misc/cytherm.c +++ b/drivers/usb/misc/cytherm.c @@ -311,7 +311,7 @@ static int cytherm_probe(struct usb_interface *interfac= e, if (!dev) goto error_mem; =20 - dev->udev =3D usb_get_dev(udev); + dev->udev =3D udev; =20 usb_set_intfdata(interface, dev); =20 @@ -334,8 +334,6 @@ static void cytherm_disconnect(struct usb_interface *in= terface) /* first remove the files, then NULL the pointer */ usb_set_intfdata(interface, NULL); =20 - usb_put_dev(dev->udev); - kfree(dev); =20 dev_info(&interface->dev, "Cypress thermometer now disconnected\n"); --=20 2.52.0 From nobody Thu Apr 9 21:49:53 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 3BF2636F40E; Thu, 5 Mar 2026 11:15:28 +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=1772709328; cv=none; b=jhTicf6PVOowf7h4nJ2N3qyVt/Q45IBWn73TRg7S2vOIym7pahzvxtAukMaDIoizEZO4v8MNvRnMCkbPJdVZbE0ngiewKJqAX2LCw1qCe3JMZnW24oRZRfM/m8U98zocgU6WOPDY0M8voCE8WOH11EgyN03N8/inzotRw8MdaJQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772709328; c=relaxed/simple; bh=YX6VeJZoImKept7XZEeAhxhhHVTyX4TzApXk5bpoRrM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=o3h6bG6gH0RWuNkIvk8Cxe876nSrAG91vmEs2jUNVwokaPLstrOcKCpsyR4YkcTY2ZtmzhUpxmoENaYX6B4zRAnvHgq4LrcRxhgs5x4My1GGwvx0i8VH1BjX18TBqUUSdWvR1BxuRGOCwd8VlT/+Is1kPa/EZaIfvWipEyjTUcc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EC3YoEtv; 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="EC3YoEtv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1296EC2BC87; Thu, 5 Mar 2026 11:15:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772709328; bh=YX6VeJZoImKept7XZEeAhxhhHVTyX4TzApXk5bpoRrM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EC3YoEtvNkWDguq9ApRsCFWsrWCZzppYRYqKnU6rd9/plfXVz70WL4PEIIwY4IFFs GtxcqW1O4uSvaFVO2N7bnwVONt4NmiWHVENT2+iXlQPjTsmhhOVWFZG89Mh5jPl7jE vIgFZPoNmdtWikRAIjLZ0F7mcxyIGuNtQqyKXHX7rTT4xEx+TrACf1Pwov9cJ5w+DV CLiqCn3JaNQsjPNUxVictqCBum5QqzmDxOK47B69+Bgy3CNvjH1GBtxBqf+DNQP2u8 zzLjiD2puVOzU+3PC0FVrdiIPtNS6l1xL1JQKtakocOklLAhQfyCT+ZceVrako4yiY qTcbqt+uoUSGA== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vy6ft-000000004ni-3r1G; Thu, 05 Mar 2026 12:15:25 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Lixu Zhang , Sakari Ailus , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 3/5] USB: ljca: drop redundant interface reference Date: Thu, 5 Mar 2026 12:15:09 +0100 Message-ID: <20260305111511.18386-4-johan@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260305111511.18386-1-johan@kernel.org> References: <20260305111511.18386-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 while it is bound to a driver and there is no need to take another reference unless the interface is needed after disconnect. Drop the redundant interface 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 Acked-by: Sakari Ailus --- drivers/usb/misc/usb-ljca.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/usb/misc/usb-ljca.c b/drivers/usb/misc/usb-ljca.c index 7e85fd12da56..c60121faa3da 100644 --- a/drivers/usb/misc/usb-ljca.c +++ b/drivers/usb/misc/usb-ljca.c @@ -776,7 +776,7 @@ static int ljca_probe(struct usb_interface *interface, init_completion(&adap->cmd_completion); INIT_LIST_HEAD(&adap->client_list); =20 - adap->intf =3D usb_get_intf(interface); + adap->intf =3D interface; adap->usb_dev =3D usb_dev; adap->dev =3D dev; =20 @@ -787,7 +787,7 @@ static int ljca_probe(struct usb_interface *interface, ret =3D usb_find_common_endpoints(alt, &ep_in, &ep_out, NULL, NULL); if (ret) { dev_err(dev, "bulk endpoints not found\n"); - goto err_put; + goto err_destroy_mutex; } adap->rx_pipe =3D usb_rcvbulkpipe(usb_dev, usb_endpoint_num(ep_in)); adap->tx_pipe =3D usb_sndbulkpipe(usb_dev, usb_endpoint_num(ep_out)); @@ -797,14 +797,14 @@ static int ljca_probe(struct usb_interface *interface, adap->rx_buf =3D devm_kzalloc(dev, adap->rx_len, GFP_KERNEL); if (!adap->rx_buf) { ret =3D -ENOMEM; - goto err_put; + goto err_destroy_mutex; } =20 /* alloc rx urb */ adap->rx_urb =3D usb_alloc_urb(0, GFP_KERNEL); if (!adap->rx_urb) { ret =3D -ENOMEM; - goto err_put; + goto err_destroy_mutex; } usb_fill_bulk_urb(adap->rx_urb, usb_dev, adap->rx_pipe, adap->rx_buf, adap->rx_len, ljca_recv, adap); @@ -836,10 +836,7 @@ static int ljca_probe(struct usb_interface *interface, =20 err_free: usb_free_urb(adap->rx_urb); - -err_put: - usb_put_intf(adap->intf); - +err_destroy_mutex: mutex_destroy(&adap->mutex); =20 return ret; @@ -864,8 +861,6 @@ static void ljca_disconnect(struct usb_interface *inter= face) =20 usb_free_urb(adap->rx_urb); =20 - usb_put_intf(adap->intf); - mutex_destroy(&adap->mutex); } =20 --=20 2.52.0 From nobody Thu Apr 9 21:49:53 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 61901386431; Thu, 5 Mar 2026 11:15:28 +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=1772709328; cv=none; b=kdtE45vE1ECxa9wUY3gBuAA0UVPBgyd4hPkIv77La6zPB59kk52hyuRI51hiEUTGkaSah7Qc568kaMgimOsLlbgMhJqtI7a5Ipd1bYmIr3d92Dzuy+OqPO4h+gbDk6/CukO1Ne34h2r3BdqWl6LGouryw2Vu4riacF4KLVP2KMM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772709328; c=relaxed/simple; bh=1AiE2nAY8josHKUT6kRxF3mlw9VySkREoY8DEdUcpGM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z+tK8aQlPmeinL5HJVknJe102TioOGzAmzdwFQCqkSplr+5xIU1YLBn+YazBouP+Jaj2qUn4ZRcQsLu7KTTlBiSL0tlu1JnNEM5N6bRqgPMqJTUGQDMHPj63kkw+XhnvvgHGc9CVr09Q+uBjtEkihHCRrIsAXKb0V4T17j8mk3U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MkG59GJq; 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="MkG59GJq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BF7AC2BCB5; Thu, 5 Mar 2026 11:15:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772709328; bh=1AiE2nAY8josHKUT6kRxF3mlw9VySkREoY8DEdUcpGM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MkG59GJq43BLzxauzkA2VuaFTA51HPRcraXUuKuFZHJRj1RPPpVWUFDN1yr5Olq0J nCkZIckUM+czN1a6txyttOr53oW8kU5+YOeui6YBRL4gtd44OmrLIvE6gLRqpzcoxU wNzlLVYd+u0rNqMzG0IzLrLYJ2gJ6QjbZ1F/FRR6Se+R44JVfZUXvbyUP/ORzpAUQ0 d0wtE9ZLUUd7Mw/0pFZ94ldqAq+y47AIuxDMnaYhieZ4hDkVj8px1YiSpMJgp5LmFG LkcO3pw5v8Q7M2uqAxN8ZYKzUDPw0SCXIJh4RM+G+ByYuv04N5FBTFk7vOINaGjeVI nJqLXqENhukNg== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vy6ft-000000004nk-3tki; Thu, 05 Mar 2026 12:15:25 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Lixu Zhang , Sakari Ailus , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 4/5] USB: trancevibrator: drop redundant device reference Date: Thu, 5 Mar 2026 12:15:10 +0100 Message-ID: <20260305111511.18386-5-johan@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260305111511.18386-1-johan@kernel.org> References: <20260305111511.18386-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/usb/misc/trancevibrator.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/misc/trancevibrator.c b/drivers/usb/misc/trancevib= rator.c index 6aaec2db360b..37f6b79889a6 100644 --- a/drivers/usb/misc/trancevibrator.c +++ b/drivers/usb/misc/trancevibrator.c @@ -92,7 +92,7 @@ static int tv_probe(struct usb_interface *interface, goto error; } =20 - dev->udev =3D usb_get_dev(udev); + dev->udev =3D udev; usb_set_intfdata(interface, dev); =20 return 0; @@ -108,7 +108,6 @@ static void tv_disconnect(struct usb_interface *interfa= ce) =20 dev =3D usb_get_intfdata (interface); usb_set_intfdata(interface, NULL); - usb_put_dev(dev->udev); kfree(dev); } =20 --=20 2.52.0 From nobody Thu Apr 9 21:49:53 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 47AD7370D6F; Thu, 5 Mar 2026 11:15:28 +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=1772709328; cv=none; b=WcngKOTSBslBSKa6UQPvayhxA9yhlRcev74xhUHYOB4aZyz6J50Du/lAGJ2RPrKuCRFcJcFyeDKjBirUuMGEcWD1qb+fysNvRmn9r6sbUbs4fV/AElkr8vr4tcEcE2/7rx2KA0E/+jXnU7ZuahrG5V+sfwCe/mKZoQPR0DJY76Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772709328; c=relaxed/simple; bh=KiK5Y9NZw9Swe3ZOWiVZxoM5uaXwYIAh7q6GAC/OnmE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=COZ76G9HskdBtyRlrIR2EkqCMQtiT4Iq6tQr2PDPiuqfTZmunO9Cw+p0whFNFqtTpMEDtSRi4gceFy1iXzdZ8npRhbQdHnqtReoARoUX22x+3GnREkXW96oAZ5qTgLvQzE5Q9GmfERs5FLq+IjwHd3VcwIRpxSef+mL3aZfNu+8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=p2vRjvai; 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="p2vRjvai" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E17DC2BC9E; Thu, 5 Mar 2026 11:15:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772709328; bh=KiK5Y9NZw9Swe3ZOWiVZxoM5uaXwYIAh7q6GAC/OnmE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p2vRjvaiKkbuvo9rWcQdHrTxPReL/3YqQgSmc8ig+jpXVcAdNovnasuzukjZ8vJ9l T/5bnkzMD/XVHYF03rFcLgbyKTzPmWO8tga6g++CCeX9wOQCQSN5DL2XezRzt56BbZ CAWG3dBBBAzng+6tlqwWC1VyfsMPkq5AfBpZijnCKtaOG6ai1aSygHFjnj16P+JPFX NWZ4AUSOf41Xnap96m8R9GyGbM308M2OH0s3u8wT9glXM50e9KgZ3fncyS54frGwaL OA376x0nd6w7fCr7ci+pKOQj9GbiLfu7NSygBOHCwdsr8MazW0mu/pjoMJOPzJ35vm y4t4og3jZwzTQ== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vy6ft-000000004nm-3wTI; Thu, 05 Mar 2026 12:15:25 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Lixu Zhang , Sakari Ailus , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 5/5] USB: usbsevseg: drop redundant device reference Date: Thu, 5 Mar 2026 12:15:11 +0100 Message-ID: <20260305111511.18386-6-johan@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260305111511.18386-1-johan@kernel.org> References: <20260305111511.18386-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/usb/misc/usbsevseg.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/misc/usbsevseg.c b/drivers/usb/misc/usbsevseg.c index b37bf53dd54f..89d25fcef642 100644 --- a/drivers/usb/misc/usbsevseg.c +++ b/drivers/usb/misc/usbsevseg.c @@ -312,7 +312,7 @@ static int sevseg_probe(struct usb_interface *interface, if (!mydev) goto error_mem; =20 - mydev->udev =3D usb_get_dev(udev); + mydev->udev =3D udev; mydev->intf =3D interface; usb_set_intfdata(interface, mydev); =20 @@ -338,7 +338,6 @@ static void sevseg_disconnect(struct usb_interface *int= erface) =20 mydev =3D usb_get_intfdata(interface); usb_set_intfdata(interface, NULL); - usb_put_dev(mydev->udev); kfree(mydev); dev_info(&interface->dev, "USB 7 Segment now disconnected\n"); } --=20 2.52.0