Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1711964rdb; Tue, 20 Feb 2024 05:02:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWicQOfnIAIeK8D+nV2PMfFrnqvuakII/IM9ctMbDaoznsDZ+m/R1kxeNTkUGVn/jtxJbM5hKELYk6zpx91SFAVIIUGxgrEsD4fpdX6SQ== X-Google-Smtp-Source: AGHT+IEbWqMdcDjMts0Z1JkBAz/tUnv0YD33d2S0IPAm4V+RWOFzz5dMFD0rCZjnqX8A3l+de2IB X-Received: by 2002:a17:90a:b887:b0:299:4ac2:1514 with SMTP id o7-20020a17090ab88700b002994ac21514mr6840574pjr.6.1708434178828; Tue, 20 Feb 2024 05:02:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708434178; cv=pass; d=google.com; s=arc-20160816; b=GujG5yAzB/PJ3UyQDO2REZbXCwK/K307qbko6c7ZiqvBF0Kts7TD+WV/ZMiAqqPhDe onON/cUFRrrbmDlTJwbP2pSEtQvfcCdY+/ePfRSasU4562OPOMIIcbk02nbMEvez5C9/ vQ3st5xpk2W1xBPMLLR65bTMvHAZK2Vo9vSlzL0GpRiNmNZuHeBFCQOf8FASGTwnspSR b37rIrjXUq2364A1B/iUoxygrSsS2PusPWDeBemS6OkfrPL5Dc6rSyubf2HXXyYJ02Rj 9GIM7KpD7PDle5hjbbstcXMg1vqXjXIyQXO5VtYbc9KFn0Ik+JC+X11E80+U984O1Ehb Fbvw== 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=9au07Xh01iDRJ+ACUJBW7SSYVgdZeUNwdPgErwM3qcI=; fh=f8PPqvHeiDsn160a5KR2uW+qiBwGxWYrow1JwjWdhWc=; b=PoKyd2svhmJ1wujP0Kt6V9CrsSZ0sT8itW64GzIAa3ucYr2Y91HyjePlM/acJJImVr JDei0zK7b40djVD1AAOPxJE7L9jATml02Fd7jJLNOkbcKUd9uAT4EYsvWe/43Jnw4R+y sEfHhL9K9XXusGzuho85oszD7k5ZM0e1YXjoP79sk3pOYi8TKuzc7RysmZjowznZsWla 4ouDD4HZD/GkEZefLWwFREhc3ieVEZxJTmN6XigSyCAACWJKF6WBOThTECCoTTA5b5yN yXiOXH1pMqk1ghK+dbfC9fW69IjBsgebez3wkl8I3Lmp2UgavjA9NAPwa+i12zy3TORR 9EqA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=jx5LoPBI; 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-73046-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73046-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 db8-20020a17090ad64800b00297074eed36si6244917pjb.181.2024.02.20.05.02.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 05:02:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-73046-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=jx5LoPBI; 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-73046-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73046-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 D60EFB22F90 for ; Tue, 20 Feb 2024 12:56:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AE3C26A014; Tue, 20 Feb 2024 12:56:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=inria.fr header.i=@inria.fr header.b="jx5LoPBI" 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 9F9A4692FC; Tue, 20 Feb 2024 12:56:36 +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=1708433800; cv=none; b=lj/tg8eVufAsvV5NqGVMDTcBuXEqezKvy2VsJM/5QDoP093lCsR0hZ5OSbDMYbLKIKfbJKY6NGKwZBdG4ZAlA7PK63nKXuJbkDV+yjr0jnq+kNt/7v19NcdILln/Af7u/XlB4fgzQ5lT/AECeloDzVv9ZRAHZosr+gPNbPgynUE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708433800; c=relaxed/simple; bh=s4v6Xnvn52zorxzG4hHVAEPraxeBhvaxAYR3NLmTy20=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=iCKHyGOqKLUqDwIgTCpEimz5vgFpBrTmET/y9JNZBVKYolD4z6f8fF1LkBrEBcFCEzU84YsHuK/zPP7amkcfQFIz3bYMu633sL978Uks/EKCZzcUWrf0C+PghosOKOMVCwUstpmKkRvJMUK3VdhmIAlAJGrI/315LMJQOhU3w2A= 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=jx5LoPBI; 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=9au07Xh01iDRJ+ACUJBW7SSYVgdZeUNwdPgErwM3qcI=; b=jx5LoPBItkfHfuclOjTGg5Q4+FsH+nbRtAtc48kC7ZInLuMw5muJDRvN MroUg2Fkmyyn5UPPuiXnKqw8Ookr9roTqicSTxFs4N5swy7M5E0OfUcUc /Jd+s0uI3prUec+2sXTJA6jssedrYiLF3O6KLasFEudDXLglnP9c7WdiG s=; 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="80136711" 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 13:56:33 +0100 Date: Tue, 20 Feb 2024 13:56:32 +0100 (CET) From: Julia Lawall To: Dmitry Baryshkov cc: Johan Hovold , 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 , 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: <4938592e-3f7c-c1ae-dce3-fd1ca363296@inria.fr> References: <20240217150228.5788-2-johan+linaro@kernel.org> <1afc87c-2c1f-df10-a0c8-2a267d44122@inria.fr> 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-1952825116-1708433793=: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-1952825116-1708433793=:3417 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT On Tue, 20 Feb 2024, Dmitry Baryshkov wrote: > On Tue, 20 Feb 2024 at 13:52, Julia Lawall wrote: > > > > > > > > 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? > > I'm not sure about it. Those are long-living variables, so they are > not a subject of cleanup.h, are they? OK, I didn't look at this code in detail, but cleanup would just call of_node_put, not actually free the data. julia --8323329-1952825116-1708433793=:3417--