From mboxrd@z Thu Jan 1 00:00:00 1970 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 38483285C88 for ; Thu, 5 Mar 2026 12:51:11 +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=1772715072; cv=none; b=Fz1q8ewqnzKjpwzJoXMcJpGq8TPfQDIb5waFHUZ4j5Mx3QFKFKln5oodtB/a5MsxRVgNjWnhB3ioO9fezQUqi38gpV4rHNKnfTeASVd6P/pOCs0aLQY96Pj+gjQXcx3deZe6Z7o6SanAHv899jNi1/6W1Db/wPyJt326ezrGLgk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772715072; c=relaxed/simple; bh=njXEsTMZ5BShzocq/55WZmd2JpFbSJspeiUMScX2Utc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Ciw00GTtzQx9ZJzs/RbpVY5lQXM2LOTg3SfzY6NuBD8L+OYsF+sShWy68AXiafeJDB8agSZWN39d2/zSqLI7yQTQvFf5kXD9fpjGWsriDKgL3LuyK7Z6mWN1aeoOdyQ0Mq+ow4XcZBvL/Kc0NrSA4xPNEsd0n83HKSE29iDDC3E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EaGSXi5A; 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="EaGSXi5A" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD5F6C116C6; Thu, 5 Mar 2026 12:51:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772715071; bh=njXEsTMZ5BShzocq/55WZmd2JpFbSJspeiUMScX2Utc=; h=From:To:Cc:Subject:Date:From; b=EaGSXi5AYVjcDf6X8IUmWKQS/MtNYPo2KwimlHyvoQj4LRpEapYlbysxJLyK0tGQl osl3vQjvWuYXXVIthgyCIrOojXAi+xENEK/RDfH42XWxAOZcWooanqMZRTWYZq2UAj B01NsgJA2LBAwr7h82rEpR8NYlMmDla3TCG0vifXEdryO5j6eX5kurYFDcyvxQOune 0fq0I/noqycVP3rGZOcbC7891rZhaK0yJh5iPEoIBQNkM1ED16uLrokLzE0ByQdEUK +XmMlZOXlt+vie2q/u+DLftGNtAlACThavw+T6P6E5RuoLBHyEIeygkDmlnRu62xUF 5/cr2AcLITAYA== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vy8AX-000000002pf-1xzK; Thu, 05 Mar 2026 13:51:09 +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] greybus: es2: drop redundant device reference Date: Thu, 5 Mar 2026 13:50:36 +0100 Message-ID: <20260305125036.10856-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: 8bit 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/greybus/es2.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/greybus/es2.c b/drivers/greybus/es2.c index 6ae0ac828afa..bb513ef7f7ff 100644 --- a/drivers/greybus/es2.c +++ b/drivers/greybus/es2.c @@ -806,8 +806,6 @@ static void es2_destroy(struct es2_ap_dev *es2) udev = es2->usb_dev; gb_hd_put(es2->hd); - - usb_put_dev(udev); } static void cport_in_callback(struct urb *urb) @@ -1257,7 +1255,7 @@ static int ap_probe(struct usb_interface *interface, bool bulk_in_found = false; bool arpc_in_found = false; - udev = usb_get_dev(interface_to_usbdev(interface)); + udev = interface_to_usbdev(interface); num_cports = apb_get_cport_count(udev); if (num_cports < 0) { -- 2.52.0