Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1571081rdb; Mon, 19 Feb 2024 23:25:43 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXun0hz4EQBZaOUfSy6OsGujnNbQ0+cTLKxGwBycMNM6BakrO2pnUcyNAFu78u3vaQAjuC8sqQPgMuj3fSEWDspl1eoSjs6tS/DE67S2g== X-Google-Smtp-Source: AGHT+IHm/dh4LL96+j5QBsvpRNWsWM/LXYAxxqNrU7jAoke43cahTbuYkaFILuiUdmGH1v0xD02X X-Received: by 2002:a05:6214:20cb:b0:68f:1a31:1b7f with SMTP id 11-20020a05621420cb00b0068f1a311b7fmr19144097qve.18.1708413943395; Mon, 19 Feb 2024 23:25:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708413943; cv=pass; d=google.com; s=arc-20160816; b=ZP6eOYZ9iEnvdPlMnsFlZQ/AdgSMdFTdfmVOsxDXtCiE88sNNao1Pudr1J658aRRas YqjIu8gia7zSb8RxzXiWp5l1LS3krj4yw1lTuyXfD9gOc4Vg1HgxAKAMCJgDcfRS4ILu BMb+oeFvVOctA0InqhYtTWicIfW5lHZPv7JFgIPHtfNl3ihwFMPuejONPZDredk8ojCD 19ZbYNaemaVPDdh0aGytW8N0zdyuX1t8PEsP8R3JEn6Mj4Or4SKt9gaJMFEOF/E/BJPG rx2IhWkf8xW7hTsbDaoB313dGIjnQhT9XY18Ya/dlAAKyAsm2ldislYPBUNGIjNI/JHc uhlw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=NaA1hZLqRaFE3HDqpaB5C2/j8Y4dARloTMw+rAYOyFw=; fh=J67wa7RwF16M5VFNqu7Ygzi6DZYhw4KyNGok7FTIij8=; b=bR4SKO7R4ai+rSnGy0YaOrrHns4bK76RRX/ukXuyQDGw2E6v4BVLCOvxZTKJg07r9S eU0eEouL/mOUTQzD2hBqxxTD7lH/lT4rxxhVqOdBykQB/4mHeISfYFRVPLzQeno9I4T7 tFjnyqs7qNmBBY6prD8Zr9fV2egKyLRlqRWczinscYxDoS5NY9g7htRjAbx/u7AMul6D 8hNrZdZRUhRsbM+0J5EM256+remnKWk4YWZWL1kmcwvRdT8HpQ3YEiqXiGOH0/9VtEm6 3PVUAQdBsA9qMBfeS29xq2plWUEOoRxmR4Q40UtLySyKE2H0Ku10I2ENvTH0tiXX0ySV MP1Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Y6WSjOKx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-72470-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72470-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id gf14-20020a056214250e00b0068c46c2e1acsi8058863qvb.547.2024.02.19.23.25.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 23:25:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72470-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Y6WSjOKx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-72470-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72470-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id CB84F1C22B84 for ; Tue, 20 Feb 2024 07:25:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0197C5B20C; Tue, 20 Feb 2024 07:25:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Y6WSjOKx" 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 249315A799; Tue, 20 Feb 2024 07:24:58 +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=1708413899; cv=none; b=YDA7ChZsGcNkQ+zJacCDxkUWMmyNdSdXmVuN0x2HATuaxhiq1B1ucu6vUWpyg50T0o2RHXOnqVnEjx7C8PkVHy/nXG3q6LN8UQcf3/Pqt4ueWsnE6UieN+BQ8bcRbELsgj9/KlnFaiNTKr73AsqQxJtBIrlKTm8lygqUUCP4G68= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708413899; c=relaxed/simple; bh=Km8gZMkJB7vNwcEvKJf3Z5MjG8s2kLrFv7d6SMKvVC4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XjfVbqr6wXtMvOkl6TZdPCZBmcRRO4r5yaR138+pEB5uDBmu5iB77MdhQ06lIwO9CMqhS2c4HyBiIIbo4I0hR+EZeItdTcNmExZn0bY2EEX8o+OD122UsDvHnEu1EYr0fSTmz2MiOpiNtQvXvt6O7vPq5RAl7tLsY2s+po7H24E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Y6WSjOKx; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96CECC433C7; Tue, 20 Feb 2024 07:24:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708413898; bh=Km8gZMkJB7vNwcEvKJf3Z5MjG8s2kLrFv7d6SMKvVC4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Y6WSjOKxHt9TBefi2fivgCw5sGg4pib4PrIDZmtoesOTgo80CtchhROVw3pw0FeqR Pc9MGfrCfAKPZbAgDQVs+NvTqOslO+bcwY0+bPdxSK2Sx7n0x9RIur2VOHGKxXS5q1 ZojucTaTTOXH7nqkaDAr7oKNW9keBDciLLBBztXj3jG96Dqy7egDtQFdz8u2Q2iBJt aWy2UUb55Fmr0MdRm5gJysrUBrLO6+m7+7BBeis1O8wXCAb8JBXQ17KOHFtUMJxzgm /zoywKFK7JfGrRP4yu7ts9/D14Ft57GqR0srDYm1N84JAeD8Tp4Vli9+dIMNop2M/1 B2HwmHPKoXLyg== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1rcKUp-0000000024l-2ZkS; Tue, 20 Feb 2024 08:24:56 +0100 Date: Tue, 20 Feb 2024 08:24:55 +0100 From: Johan Hovold To: Markus Elfring Cc: 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 Message-ID: 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: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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. Johan