From nobody Thu Apr 9 19:17:04 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 1E395345CC9 for ; Fri, 6 Mar 2026 07:55:02 +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=1772783703; cv=none; b=L/H2XvAaNA56LYeknKx2b4ZfU3j/xKy+4yN6FMis0cWRdcNFR8LMpY9emZJs+JPBoa46CfJHubrCP3IA2MUz9jnuwssPW7Md6QpzMlsTFbmZXIu9Kxn3EbRxc3d/tStVp3wmPjUjQ1CYmYUypmyLhKJNP/FEzlZvrlkqAXHCwdY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772783703; c=relaxed/simple; bh=1Lybsl8fGpg34wuqIaD6BSoi0h8hLG+AjaFlioISDCI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Oca17XZ4rWsBTVdDcy7gpaXqXh2lVFrcz7HuFnaam6QieNDQE4TnXlHl+/LPMyaSDAyV+KBi3FniucG0rfe6KUNM3huXdDctA2PSATb7UJbnTjz2F2v/ZGwD6i/x6eS789m1Hs/V2Uu4Dy1H34EW1liOM0iJKu/sfdZFo6uj4/o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GBFSVS+3; 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="GBFSVS+3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E48DC4CEF7; Fri, 6 Mar 2026 07:55:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772783702; bh=1Lybsl8fGpg34wuqIaD6BSoi0h8hLG+AjaFlioISDCI=; h=From:To:Cc:Subject:Date:From; b=GBFSVS+3cOuQvXYioEs7Y8vlz/qJrhb7vhpj5vYpgdjFSe7XAs2MHEVcIbmyh16UT ExMiWhWsw/EJuRDEJHD4GBTa029vrdsVVg9nRN3sRkLR5GkTEZtB9EGXvGdszrNvd5 r7OUwF79jPDV0Q6chuorBbHLK1JQFG6SDmhB4OHQElsfE5c2ZX0Y6Jk7uI6OUqrdPJ WubAhTpnk2dDbJkLl9VlUM8uzAIfWfOW3Z7A9zYoShWnz2RlaUSn5OdnMbufTAZ2nJ NsJyo9OIcxkKu+D7Tz9Zd1PvXTbA1/GrjcZUAaXJUtn7ZAhiqK5f727EQnT3fpG8Vu TgpbKEB7N9vYg== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vyQ1U-0000000082q-0BIA; Fri, 06 Mar 2026 08:55:00 +0100 From: Johan Hovold To: Johan Hovold , Alex Elder , Greg Kroah-Hartman Cc: greybus-dev@lists.linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] greybus: es2: drop redundant device reference Date: Fri, 6 Mar 2026 08:54:48 +0100 Message-ID: <20260306075448.30909-1-johan@kernel.org> X-Mailer: git-send-email 2.52.0 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 --- Changes in v2 - drop temporary udev variable as reported by the kernel test robot (W=3D1 warning) drivers/greybus/es2.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/greybus/es2.c b/drivers/greybus/es2.c index 6ae0ac828afa..a97868009191 100644 --- a/drivers/greybus/es2.c +++ b/drivers/greybus/es2.c @@ -772,7 +772,6 @@ static int check_urb_status(struct urb *urb) =20 static void es2_destroy(struct es2_ap_dev *es2) { - struct usb_device *udev; struct urb *urb; int i; =20 @@ -804,10 +803,7 @@ static void es2_destroy(struct es2_ap_dev *es2) gb_hd_cport_release_reserved(es2->hd, ES2_CPORT_CDSI1); gb_hd_cport_release_reserved(es2->hd, ES2_CPORT_CDSI0); =20 - udev =3D es2->usb_dev; gb_hd_put(es2->hd); - - usb_put_dev(udev); } =20 static void cport_in_callback(struct urb *urb) @@ -1257,7 +1253,7 @@ static int ap_probe(struct usb_interface *interface, bool bulk_in_found =3D false; bool arpc_in_found =3D false; =20 - udev =3D usb_get_dev(interface_to_usbdev(interface)); + udev =3D interface_to_usbdev(interface); =20 num_cports =3D apb_get_cport_count(udev); if (num_cports < 0) { --=20 2.52.0