From nobody Wed Nov 27 09:39:20 2024 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF6C31E6DD5; Thu, 10 Oct 2024 23:11:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728601878; cv=none; b=rGgMbCxQZQWlN8fxzr8QamD7EFPdrpWKWsCCwLwZ6WiL9of/RkVUJimpxtPUKrrHME9plgLCsRGtKV4y9UQtAEi4YwQquV7ZR5u8izw1Blz78ZH0u2nC6VQgNEZ2DsdMrN7/6jT9oeFsHgkj2MEObmGVWyUWaGCwSfygHawSG94= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728601878; c=relaxed/simple; bh=IZsWutkwsQdz6JsfcZXxwWl/8k7REIn4zPH/HX5ytTs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oaoSVHGiKmqGzdLtYs+GzUxHglDdMV5AKahMdGj0U6EjAbIhdKU37Q0r4UCyIKCpLtY71AGzkiIwYHXgT2nbCdAOUHHd7zfrmGl26LscvlE3+afvuWyRefuDTtT2BYqDwlmMnUMNvDnBoTrkMieOWmogppubBJfSw4A3XQYgAbo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=P4AKHNFi; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="P4AKHNFi" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-431160cdbd0so8920555e9.1; Thu, 10 Oct 2024 16:11:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728601875; x=1729206675; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=QMBH9FWJx0l+KVOa+9SWfJtBbSYbCQsEEV5rTO8JJDE=; b=P4AKHNFiftxoeHR60RfO3agMxWR/1t2dd3P4c3fr0R4Y6rmN/7Hwz3fHxA3NkwNG9t XwvvlbPYiPutAmyf9tIKtLlZfiwvPietwbIIGsS4pC6du2ru7BoS5yehISTWf0uq/CkE VwKXNjHc8iBCMgFtDFB8YjWRHRiT2jk6+qxoW9yLzKVIuFCG6mMznIy2BH/r1PbnFhKq Ikookr+u49TmJ/6PZHdPvNIHkuygThDDNOFjlFyakUl4P6wMslrVN3vqFvXTI4pvYn4r r02vOvBXYilpqXKd1neNTeuu+3jhEN/AYk36qzRs7l05XCqZMEeCfUzHDOlKVrJOTRV+ XFtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728601875; x=1729206675; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QMBH9FWJx0l+KVOa+9SWfJtBbSYbCQsEEV5rTO8JJDE=; b=HLvSoVXOIgT7oNKlc6WdY8XjEhmIUpeh5uvvG3OPWnyiOlVkbS3cVjdoM2rvGgsB6I H0xvWHPzeDsR+4597yQ+aHQQyzfgSfB3jShfLstJtF+aIlSAthLkWBqXrV71gcBS9Isa IafNIzKTqOyny3nbJ/X0iFHZHaNIbpXluqFyrSLTD81ukoCrTGcde035C237zKk5UxUF rHqxnBtSBpMJ85toPh9h7vjantOBIMiyEz+8RjqrCUNTaJfhHfML3HX/2y47FqGO4R/+ lOYDEYvdcqaTzllvivbHYdsLEoQYWuFL2S4Qwip6NfPDBuqpbjuDwbMdYZGF260kE6XR ZF7g== X-Forwarded-Encrypted: i=1; AJvYcCW7YFUTHcO2DBz2hjvBShYa/Y4poyl9hk9dEvorXrkJcWLnLc8SzDhT9qLoRDbNWG23VHP29xC0@vger.kernel.org, AJvYcCWxibBNufODcqNNDjjIJ9VtmPdLsd2mMVKnxnGQlnqIHlQ5Ng+vVOnFsgejaK19HgX+k5fJ9DyT9J/vHLE=@vger.kernel.org X-Gm-Message-State: AOJu0YxSwk2gpwXji0RIGMVgfVfMtnGfKYGfb6IIOYtuV9G2KR6WKISL A9X8dKwqLnzdt7sbZcaEOCNTSIY5O8v6mx0oq3QoUj4rIxWl+pJH X-Google-Smtp-Source: AGHT+IEYwIA6/NSQJaiEsBC2TPm1jMFPNq2BHxvPMOWmgWKUbfcxi0VUCUbp4n1lGpz6V5FTEpaF+Q== X-Received: by 2002:a05:600c:b9a:b0:42f:84ec:3f9 with SMTP id 5b1f17b1804b1-4311d884328mr5474175e9.3.1728601875208; Thu, 10 Oct 2024 16:11:15 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-3d08-841a-0562-b7b5.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:3d08:841a:562:b7b5]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431182d7934sm27465325e9.3.2024.10.10.16.11.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 16:11:13 -0700 (PDT) From: Javier Carrasco Date: Fri, 11 Oct 2024 01:11:08 +0200 Subject: [PATCH 1/3] drm: logicvc: fix missing of_node_put() in for_each_child_of_node() 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-Transfer-Encoding: quoted-printable Message-Id: <20241011-logicvc_layer_of_node_put-v1-1-1ec36bdca74f@gmail.com> References: <20241011-logicvc_layer_of_node_put-v1-0-1ec36bdca74f@gmail.com> In-Reply-To: <20241011-logicvc_layer_of_node_put-v1-0-1ec36bdca74f@gmail.com> To: Paul Kocialkowski , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Javier Carrasco , stable@vger.kernel.org X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1728601870; l=922; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=IZsWutkwsQdz6JsfcZXxwWl/8k7REIn4zPH/HX5ytTs=; b=vDiJc06bbjTXqlJJzhKcNDKePYrX8gMJetxAA7AyKGfKL3+gRD8zjKO29PA/TVHrBnXaNElJE MALOBokxz/lBZTTCZiWJS0jsedVPf5SCf2JvwCx9ds9xzpFZVTm0NNu X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= Early exits from the for_each_child_of_node() loop require explicit calls to of_node_put() for the child node. Add the missing 'of_node_put(layer_node)' in the only error path. Cc: stable@vger.kernel.org Fixes: efeeaefe9be5 ("drm: Add support for the LogiCVC display controller") Signed-off-by: Javier Carrasco Reviewed-By: Louis Chauvet --- drivers/gpu/drm/logicvc/logicvc_layer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/logicvc/logicvc_layer.c b/drivers/gpu/drm/logi= cvc/logicvc_layer.c index 464000aea765..52dabacd42ee 100644 --- a/drivers/gpu/drm/logicvc/logicvc_layer.c +++ b/drivers/gpu/drm/logicvc/logicvc_layer.c @@ -613,6 +613,7 @@ int logicvc_layers_init(struct logicvc_drm *logicvc) =20 ret =3D logicvc_layer_init(logicvc, layer_node, index); if (ret) { + of_node_put(layer_node); of_node_put(layers_node); goto error; } --=20 2.43.0 From nobody Wed Nov 27 09:39:20 2024 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 454E71E7C1A for ; Thu, 10 Oct 2024 23:11:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728601879; cv=none; b=Cnb65bMBWE5FSwCgJZZU+gEJ8h7nPJENToXGqvurcNFPuT/7QxzupTgPNeHf52BcR68FJXqoPcdwSGZgfNMheVDiJyQm9oSYgBwNGYji01FL54bZsCaHYvQrL9TDGtnyrVyeWFLF9wlrYmWmkOHHesdtangcBb/pnH2psfGpJz8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728601879; c=relaxed/simple; bh=mdTdY9w48aKKYhBF3Ntc48k1ASEGObuZ88AuC7JugAw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=X6ECnvOWHyT8KN/CStn2iXgjs8s+9Q5NhgF9aDH0jyLcDREgTIi4BLonKSiDrHoxOKjXaBqJvPC9rPQOrW18Pv35PWMvc2t6GbTxy2xD9o65P1Jvyf2i84C1CJnlXg1iJtqmwHS6JPaIH01AH7wVu38Jn0kHQ7aPA1wyJR95ljI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DYdMW+m/; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DYdMW+m/" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4311d972e3eso1430365e9.3 for ; Thu, 10 Oct 2024 16:11:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728601876; x=1729206676; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=s58+PumcrxFi8ai7328YyPN+Kl/m7WNPj0jROfEsr9E=; b=DYdMW+m/cuGrkuoBZKmxPujSn4IOHzwcaxs5cLrGLt/Mumf7FaAOYw4QtDjw4zWEjv j5W+AuBDAxIOS9N06B6PJByADQfrH0kvfi9pIP6x3TSGifOWkGBD7wAbmuxnlirrd/fq zsMnPcq0YtQ8fOh6tICfw0UugO29C/YXiQuTn5BTqzTG1Zi9NvW6XoR6Bkjx8n7l5GAQ Bv9YJuaTpB3hdw2GF6+CUz1eErM45/ZCSSacflv1ybKJvfVfOJPhEoZOnqrsGg9yceVt UmrB+p7/tfq/qNpjkaOUArYsfSKIY7uApG6ntgSONNKy8x6mUKIkp9eAx442HQz0EJ3l io1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728601876; x=1729206676; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s58+PumcrxFi8ai7328YyPN+Kl/m7WNPj0jROfEsr9E=; b=nO5ICcVIyzZYqScMDUW/2Tz8Pg/0K9Fu1Ehf0cnxuIWlCXnXvBW3XSQoyDo03oRrh2 hr4gjabVXOX8SMVSVQj+jXOMqeGa++gZOiS3kECwE/o5ycSBHY3mv951Jte4id9H3EFI VlxBWsqcdXN0NDL7mp5hwhh7erVBUfn07H3PAk9OgJ6h33jpLNPQBRBVpZ4davD7jS3i THwqrIdSdTS1YOShsXPGG37BsF2MUaxuKs6jf7JeSEgLHZoCgJLVNAAwsaSqLZsWZ9UA Lp/EnGw4bhfPGeob/LJXsVwfqt0DalSODy/QPEE5QYBKFp3snMtaG1Uve7r1YEm8DxX8 8vng== X-Forwarded-Encrypted: i=1; AJvYcCVOKq1sZ21Q9d/Y9hs21UnAX76qo8a3lgVoBaO961ZhDlRuc/menP08bLW5/LDoEA8pvxAJfubOG6jcLa4=@vger.kernel.org X-Gm-Message-State: AOJu0YySi/EC/sntjjeqdz5qKElsDxcszmWykxhVM2SUmyCCM4iyvIyu ixkPYfz99dQflZtfzA7+UICzwKV/gXOkOIjQOrPJtSC0rGPRsMi43OoFv+eA X-Google-Smtp-Source: AGHT+IGNpxnYI2exDYItoqZ2fn7Mvrf6IGBS7K8vHBpTFS5m8Lm+n/fI9fTxQdc0xpXrIqe0VaPpNA== X-Received: by 2002:a05:600c:1c9e:b0:42f:8515:e479 with SMTP id 5b1f17b1804b1-4311dea4233mr2599505e9.4.1728601876501; Thu, 10 Oct 2024 16:11:16 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-3d08-841a-0562-b7b5.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:3d08:841a:562:b7b5]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431182d7934sm27465325e9.3.2024.10.10.16.11.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 16:11:16 -0700 (PDT) From: Javier Carrasco Date: Fri, 11 Oct 2024 01:11:09 +0200 Subject: [PATCH 2/3] drm: logicvc: switch to for_each_child_of_node_scoped() 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-Transfer-Encoding: quoted-printable Message-Id: <20241011-logicvc_layer_of_node_put-v1-2-1ec36bdca74f@gmail.com> References: <20241011-logicvc_layer_of_node_put-v1-0-1ec36bdca74f@gmail.com> In-Reply-To: <20241011-logicvc_layer_of_node_put-v1-0-1ec36bdca74f@gmail.com> To: Paul Kocialkowski , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1728601870; l=1408; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=mdTdY9w48aKKYhBF3Ntc48k1ASEGObuZ88AuC7JugAw=; b=R4bdEpUM8fPQRj1JiSQWFTkvdkMWF74Xsg1B14H1Vp8DgAWXnCmnzvrXo7Obi8t7B9VMNikVg DIvUSqwtF/bDhfd3OwCcY9v+4wA6UnmtiziXgNLYpIxJWVFZNAmYoSe X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= Use the scoped variant of the macro to avoid leaking memory upon early exits without the required call to of_node_put(). Signed-off-by: Javier Carrasco Reviewed-by: Louis Chauvet --- drivers/gpu/drm/logicvc/logicvc_layer.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/logicvc/logicvc_layer.c b/drivers/gpu/drm/logi= cvc/logicvc_layer.c index 52dabacd42ee..34caf5f0f619 100644 --- a/drivers/gpu/drm/logicvc/logicvc_layer.c +++ b/drivers/gpu/drm/logicvc/logicvc_layer.c @@ -581,7 +581,6 @@ int logicvc_layers_init(struct logicvc_drm *logicvc) struct drm_device *drm_dev =3D &logicvc->drm_dev; struct device *dev =3D drm_dev->dev; struct device_node *of_node =3D dev->of_node; - struct device_node *layer_node =3D NULL; struct device_node *layers_node; struct logicvc_layer *layer; struct logicvc_layer *next; @@ -594,7 +593,7 @@ int logicvc_layers_init(struct logicvc_drm *logicvc) goto error; } =20 - for_each_child_of_node(layers_node, layer_node) { + for_each_child_of_node_scoped(layers_node, layer_node) { u32 index =3D 0; =20 if (!logicvc_of_node_is_layer(layer_node)) @@ -613,7 +612,6 @@ int logicvc_layers_init(struct logicvc_drm *logicvc) =20 ret =3D logicvc_layer_init(logicvc, layer_node, index); if (ret) { - of_node_put(layer_node); of_node_put(layers_node); goto error; } --=20 2.43.0 From nobody Wed Nov 27 09:39:20 2024 Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 06A2C1E885D for ; Thu, 10 Oct 2024 23:11:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728601882; cv=none; b=DwDXtCZZlvZVeCVCBaXyofCyAM8ADNP1olEt3a/bLtUYcFPl5DSvzd8eHI0I32l2gcpfG6QacxtSgXerTzhGwZvZBbwX/iBVqfvCAH9UpNBp3q8Iy/ZTe8lsNok4DpC4z73/VcjN2s5F+3/vsppxdu9u/1k0Gwnu1jJMH4rC+F8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728601882; c=relaxed/simple; bh=uinenbL4FzpGTciwF347QzY3mFOrkO38x8ZvWc2oCkw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lEV7fHyOlsQGQT2oBRcf/qjnY79vA+mqbIvd8iJvmT1FaYBVMufTYYAeT8bJwBvsRVondsRDTHWRU5RtEkbuJZsG/LsUUVXOIYMBwPdd5rUXnhTJ0ItNPqGv9eJJo7VylkzYjUizxK/8wWEjwFzggIfU36g2usCMfWnWCn/say4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=G6z6ZmzL; arc=none smtp.client-ip=209.85.208.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="G6z6ZmzL" Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2fac187eef2so16041461fa.3 for ; Thu, 10 Oct 2024 16:11:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728601879; x=1729206679; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=QoDVAypqQhFaK++Sbokvz3Z0Wf7Y1INjpj4oxIzXKe0=; b=G6z6ZmzLz9eVB3uOpFJckaYWC21LH9Jf/Ps5+MvBUcZb+hTEbZJJ/w80q2LyCyTbAI YwNq9yhRcDmuO7ZVjfdkd9ysNMcHiJgPZpmxbyo32C5G1U1fVgglTetDhPVqZ9XLJUfC HhMhNDAVvoxpo0uLcT8hEb50MRddh19RKQ98/LlAg2ESER1dxK/ojWjBUUXjIWO1pMkU k3KxoP/xWlbZcXjPjuTZIbNU2fWg4c0SjmisUBCDQzmVlTnHEKw0gensU635YU/1gxm1 ZbHXjIGvsVznmJddww99Qh/Iz2hIb1v7sny9uEbFmR5i7qIiwqjMdZKFQUwiP9FLrlvP mhOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728601879; x=1729206679; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QoDVAypqQhFaK++Sbokvz3Z0Wf7Y1INjpj4oxIzXKe0=; b=VV36zYnlJIu2l2LRrIX8xvzutPhisr4YyAW5Do2GZeQxoNTrqJD0Mt0MGG8Z/1a75L ChktDwH9+s7+dUGYtF4kp8bobRVQdpkb+aSE/6MA4+QXtvtfng0EqfNNYfAPxICgr9EO iOxWIh/IcdB8dkDRuflnXJTfn39Szo4YV9HbqQgi5y6cCMGOKoMdcrqdf8VXXQfBozar ErkS5Alp7c0fDZvQK8WtCjPKgKsCAEiFQcvlGu+7Ztwnjck8wJGowhvWNiXm3nQoPvOQ yUgokc7rEpM+V+qYumY8anUGndsUw9FygxmSYXqUQa/4+p5fqo7f4M6CiBzExs3Pz5QP +Rrw== X-Forwarded-Encrypted: i=1; AJvYcCXXsxC3ixqOu1SYR9593lwhopIO9QGV88SQX1C6EbWgFFySaEP63HoYTZVv1hdSj2hkQl0nE9WQ0oAYHRY=@vger.kernel.org X-Gm-Message-State: AOJu0Yz9F3sNiOkYCgZUhMgoHeK5e3wY8CYc7Vsyt9Nsiu8KJRYI98do adWSfAOyS+CArk7BLTANoec7OQOe0It1C8QJf2KAGnoUrjLQ8Eae X-Google-Smtp-Source: AGHT+IElhmpWlC2qdcNgZuGCmGHV6znGXHgoxSCTjh96T2uVOnQzrc2WOk5htA5x1FIloEn2FdMlmg== X-Received: by 2002:a05:651c:554:b0:2fa:d4ef:f222 with SMTP id 38308e7fff4ca-2fb329e7a91mr1874651fa.38.1728601878781; Thu, 10 Oct 2024 16:11:18 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-3d08-841a-0562-b7b5.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:3d08:841a:562:b7b5]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431182d7934sm27465325e9.3.2024.10.10.16.11.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 16:11:17 -0700 (PDT) From: Javier Carrasco Date: Fri, 11 Oct 2024 01:11:10 +0200 Subject: [PATCH 3/3] drm: logicvc: use automatic cleanup facility for layers_node 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-Transfer-Encoding: quoted-printable Message-Id: <20241011-logicvc_layer_of_node_put-v1-3-1ec36bdca74f@gmail.com> References: <20241011-logicvc_layer_of_node_put-v1-0-1ec36bdca74f@gmail.com> In-Reply-To: <20241011-logicvc_layer_of_node_put-v1-0-1ec36bdca74f@gmail.com> To: Paul Kocialkowski , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1728601870; l=1455; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=uinenbL4FzpGTciwF347QzY3mFOrkO38x8ZvWc2oCkw=; b=rESW73w6bQNwfU9qYsD9vjiB0TiJRGQaTu/ideF4NtwMGTMuUj07VI2HR4vxhs94W51ewLqDK +4usfVuwQMhBDTEeG+WwrzapV2yArJJeDXA8h8rlPyqKvVct5mNdPzM X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= Use the more robust approach provided by the __free() macro to automatically call of_node_put() when the device node goes out of scope. Signed-off-by: Javier Carrasco Reviewed-by: Louis Chauvet --- drivers/gpu/drm/logicvc/logicvc_layer.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/logicvc/logicvc_layer.c b/drivers/gpu/drm/logi= cvc/logicvc_layer.c index 34caf5f0f619..9d7d1b58b002 100644 --- a/drivers/gpu/drm/logicvc/logicvc_layer.c +++ b/drivers/gpu/drm/logicvc/logicvc_layer.c @@ -581,12 +581,12 @@ int logicvc_layers_init(struct logicvc_drm *logicvc) struct drm_device *drm_dev =3D &logicvc->drm_dev; struct device *dev =3D drm_dev->dev; struct device_node *of_node =3D dev->of_node; - struct device_node *layers_node; + struct device_node *layers_node __free(device_node) =3D + of_get_child_by_name(of_node, "layers"); struct logicvc_layer *layer; struct logicvc_layer *next; int ret =3D 0; =20 - layers_node =3D of_get_child_by_name(of_node, "layers"); if (!layers_node) { drm_err(drm_dev, "No layers node found in the description\n"); ret =3D -ENODEV; @@ -611,14 +611,10 @@ int logicvc_layers_init(struct logicvc_drm *logicvc) } =20 ret =3D logicvc_layer_init(logicvc, layer_node, index); - if (ret) { - of_node_put(layers_node); + if (ret) goto error; - } } =20 - of_node_put(layers_node); - return 0; =20 error: --=20 2.43.0