From nobody Thu Apr 9 23:22:25 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 026B1379EEF for ; Thu, 5 Mar 2026 10:40:59 +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=1772707260; cv=none; b=AFV9TmytdkMa5aUfofPPK8aXWP2blmUKXa7orEVG7A/fR+g7lP96BWSmKzTw0GXOmNvwbjQDpjEZ4L6T42Oi0oo22e5J/O3BsSh1sNMAZUD2NvJ5uPh0w+FkikGtXShSGPBFrudekvcfvcKF5O4nDSR3pmZ3gT3WZKcPcVOA3H4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772707260; c=relaxed/simple; bh=eS6sq8bLYA4AumgFHNhAso7PJTIqIc8Sczhh46nFrJo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Z5bowkv9Ht3QvVIm9Iwwp1yJnlZc35fWbwZGEfSmgYBme2i9pV2Z/hYl1yy1ezA4Hb1b8x39C8Flbaa5yJGwtee9pA/L5OzO8wmfjLM5yqp/Cww1VbE8tFcdLizj+PIxb8WmdOQ+ScaEXOT4bZ5zCD7e1pk/voIl1iyYbE2WEVE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GxzqEZyo; 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="GxzqEZyo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 546E8C116C6; Thu, 5 Mar 2026 10:40:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772707259; bh=eS6sq8bLYA4AumgFHNhAso7PJTIqIc8Sczhh46nFrJo=; h=From:To:Cc:Subject:Date:From; b=GxzqEZyo8pdUicWtFV4Am0hhjaQVjzzYpK/qTIwOd+CSytlJKGPCdfpG75xcxfGx9 Zd4pq1g/OzVVtZtjpn3G0ON7FiMNXEZSm9qVfNF1shZSrDisuhmM3A7/QKzgK3Pv8v UbMXF2L//12dfHRTJ3oVKe8yOI6PjiUDGNvMPb6HkNjYxB5ON0YtuDkEaUm4abcutf hmSg9IJSObfXnFGokzJkkAtHSFxzb/2ocoFaAy/5M4NZAvFk8lu6QYyN443z8LgG5w OOVRrbX/0biSwQLHqp5nuBMTRiZKGuspuEXcWqohtzOszilUAwyN7Nrk0tfv9HMahz wTUkrDRAIaKYQ== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vy68W-0000000045x-41ef; Thu, 05 Mar 2026 11:40:56 +0100 From: Johan Hovold To: Lee Jones Cc: linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH] mfd: viperboard: drop redundant device reference Date: Thu, 5 Mar 2026 11:40:51 +0100 Message-ID: <20260305104051.15727-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 --- drivers/mfd/viperboard.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/mfd/viperboard.c b/drivers/mfd/viperboard.c index f964bcfa0796..888737b8e7be 100644 --- a/drivers/mfd/viperboard.c +++ b/drivers/mfd/viperboard.c @@ -59,7 +59,7 @@ static int vprbrd_probe(struct usb_interface *interface, =20 mutex_init(&vb->lock); =20 - vb->usb_dev =3D usb_get_dev(interface_to_usbdev(interface)); + vb->usb_dev =3D interface_to_usbdev(interface); =20 /* save our data pointer in this interface device */ usb_set_intfdata(interface, vb); @@ -96,10 +96,8 @@ static int vprbrd_probe(struct usb_interface *interface, return 0; =20 error: - if (vb) { - usb_put_dev(vb->usb_dev); + if (vb) kfree(vb); - } =20 return ret; } @@ -110,7 +108,6 @@ static void vprbrd_disconnect(struct usb_interface *int= erface) =20 mfd_remove_devices(&interface->dev); usb_set_intfdata(interface, NULL); - usb_put_dev(vb->usb_dev); kfree(vb); =20 dev_dbg(&interface->dev, "disconnected\n"); --=20 2.52.0