Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1680625rdb; Tue, 20 Feb 2024 04:02:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWBrBObI41fNXJufBg0yu4v41fw7rv4ZTsZJM94QGq11djAgOLQGk+A7iemAXT03LVi7acoE5J7T7RmrnukjQ6q9V3w8bzOM9tOrKtFsg== X-Google-Smtp-Source: AGHT+IGkytCEL65cNWPcrCE1Kzr5+LPn4xQyV6cVpZaAKRzr22oEQoImePuuIzTX1dyWvmEYA7th X-Received: by 2002:a17:902:c94e:b0:1db:def5:17e4 with SMTP id i14-20020a170902c94e00b001dbdef517e4mr9072603pla.7.1708430529192; Tue, 20 Feb 2024 04:02:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708430529; cv=pass; d=google.com; s=arc-20160816; b=QrzhHQrlqa6dpgSr6Lrjk62uBDWv3125Ex/38G7Cm7bgJcTrRsx5I1c+2ZP+Voujjy fGaSMqJylRdoBBsiStVLxJCTPy9LPJwlyHKfQpItx65d58D6ajTyV9wbdhznAIzIw74I PdYZRHKa1l892Lx6EtQw3Tg3ZCcfbcomDnwOJk/xuty53vZfjfr3VkbqWeToO9vAHGa3 znmuuYNm6DWB8Ccq7dELI7PCgnlqiFoQ393it8NDzs699Hczkg1V+ekmXKyY6dN0obxl f5qT1KvlYm99+6B1mhLFvVr/VTCE1bmjRHIf/Cz4RPRKzH0SrC3SaO9MzTUrOPs7GLEw YyBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature; bh=1M4BVBMt80+EpGUdBvcdqZq7UMSH5rmWkvh/86/IyP0=; fh=Jo4hdaPXjrJz7RdvO1a32qa3QD5Mrs6kGeBf+ANKIiU=; b=nbKToA4dBaPGGfPlC+R+BSJnDy6/JhvgWXif24BcSKBzLCwUpu1Rq3/hGOkGyoxZPn qDc2cvT/H6aYL2QUoxqY9TD0AvfYOaewbc8ubCa7muxoF6Rm4FkSE3kD1Q3QUA/wM8o4 jYBLJqQGHcfhF93JT4dZXDiAS5fKth92eRlgnPyUVfllVwlxdDCNNBLOwM8QLgzy0sb7 SmL/qt1QaKLPWtw0zqlVtT88ipctcgFS3UfDQx37fRQEf2pS/kWHjKpT+F0CKV55/FBY 795bXpri0kl5xmwsl0cM1N/wZuCYPQwHyHRPubiC73w/pohfg6FvS8/TBYjGC+v3keAK 40nw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=Pql6VQnC; arc=pass (i=1 spf=pass spfdomain=inria.fr dkim=pass dkdomain=inria.fr dmarc=pass fromdomain=inria.fr); spf=pass (google.com: domain of linux-kernel+bounces-72948-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72948-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id jx10-20020a170903138a00b001dbeb95bb04si3676325plb.69.2024.02.20.04.02.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 04:02:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72948-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=Pql6VQnC; arc=pass (i=1 spf=pass spfdomain=inria.fr dkim=pass dkdomain=inria.fr dmarc=pass fromdomain=inria.fr); spf=pass (google.com: domain of linux-kernel+bounces-72948-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72948-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 382D3B25DD8 for ; Tue, 20 Feb 2024 11:52:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C0B0C67A19; Tue, 20 Feb 2024 11:52:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=inria.fr header.i=@inria.fr header.b="Pql6VQnC" Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) (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 2A738679ED; Tue, 20 Feb 2024 11:52:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.134.164.104 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708429958; cv=none; b=mrPVNBW0p3Cb137p6tVXTBRCxsoDeU2vYcTnA+rfN1u10/UsRP/BVI87fSQ8XVAPZlNzWGGjAzdaUZIz1BivK2jYwL5e/kkDOFGxzqnsleqRBzCZ8O7ZITo7w5sXm9bHVbHiAKw11w9ZEvPts4o4urZPu/8l+jeBSKoGZmOQI/A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708429958; c=relaxed/simple; bh=Yp7or4NmnKQ2k4cpEJmMyo89KUtKqSrOMkPLtnvypLA=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=MF+9oRcz5DI9f7+dTJoXU1rYNw0LcFwVZ37fZZ3YKR+y4Gq3Q21xu+K/P49s/WT703Doc4l5a/cOEBFsORo0rPtAByw1uhKU+ftuBw+xHb7AaXcHwnApEPOQ6Yy0LS1UVbWi5eBXQLUKUOauEnG5ObX89aIzCMt88KCKadcerVU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=inria.fr; spf=pass smtp.mailfrom=inria.fr; dkim=pass (1024-bit key) header.d=inria.fr header.i=@inria.fr header.b=Pql6VQnC; arc=none smtp.client-ip=192.134.164.104 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=inria.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=inria.fr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=1M4BVBMt80+EpGUdBvcdqZq7UMSH5rmWkvh/86/IyP0=; b=Pql6VQnC508MlZQr0ue7CCu89plVt/X6lTdZnJ+Of3+4gTP5Ip6joogh 27bbqBwHYV2sV2qL7VhZJLKnUzpN89pRC+l90k8ldZjsXwMvkYZhacpsn c/QtgZ0mSU1Gfgg+8IRt5GbdySMyiWwcPKq7o5D3v1szRxKr1MizjemHy 0=; Authentication-Results: mail3-relais-sop.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=julia.lawall@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="6.06,172,1705359600"; d="scan'208";a="80129118" Received: from dt-lawall.paris.inria.fr ([128.93.67.65]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Feb 2024 12:52:25 +0100 Date: Tue, 20 Feb 2024 12:52:25 +0100 (CET) From: Julia Lawall To: Johan Hovold cc: Markus Elfring , Johan Hovold , freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-phy@lists.infradead.org, linux-arm-msm@vger.kernel.org, kernel-janitors@vger.kernel.org, Andrzej Hajda , Bjorn Andersson , Daniel Vetter , David Airlie , Maarten Lankhorst , Maxime Ripard , Neil Armstrong , Robert Foss , Thomas Zimmermann , Vinod Koul , LKML , Abhinav Kumar , Dmitry Baryshkov , Jernej Skrabec , Jonas Karlman , Kishon Vijay Abraham I , Konrad Dybcio , Kuogee Hsieh , Laurent Pinchart , Rob Clark Subject: Re: [PATCH 1/6] drm/bridge: aux-hpd: fix OF node leaks In-Reply-To: Message-ID: <1afc87c-2c1f-df10-a0c8-2a267d44122@inria.fr> References: <20240217150228.5788-2-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1071210912-1708429945=:3417" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1071210912-1708429945=:3417 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Tue, 20 Feb 2024, Johan Hovold wrote: > On Mon, Feb 19, 2024 at 06:48:30PM +0100, Markus Elfring wrote: > > > The two device node references taken during allocation need to be > > > dropped when the auxiliary device is freed. > > … > > > +++ b/drivers/gpu/drm/bridge/aux-hpd-bridge.c > > … > > > @@ -74,6 +75,8 @@ struct device *drm_dp_hpd_bridge_register(struct device *parent, > > > > > > ret = auxiliary_device_init(adev); > > > if (ret) { > > > + of_node_put(adev->dev.platform_data); > > > + of_node_put(adev->dev.of_node); > > > ida_free(&drm_aux_hpd_bridge_ida, adev->id); > > > kfree(adev); > > > return ERR_PTR(ret); > > > > The last two statements are also used in a previous if branch. > > https://elixir.bootlin.com/linux/v6.8-rc5/source/drivers/gpu/drm/bridge/aux-hpd-bridge.c#L63 > > > > How do you think about to avoid such a bit of duplicate source code > > by adding a label here? > > No, the current code is fine and what you are suggesting is in any case > unrelated to this fix. > > If this function ever grows a third error path like that, I too would > consider it however. I guess these of_node_puts can all go away shortly with cleanup anyway? julia --8323329-1071210912-1708429945=:3417--