From nobody Mon Nov 25 02:26:29 2024 Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.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 14A1B219C8B; Wed, 30 Oct 2024 17:10:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730308262; cv=none; b=tu5Usf0aTaPb6SCl6d33gTcZugwlZvB25J9XeWmgUcqYJbDBDe91DBTUZK0NHXYIRWPm9Jf1qQDlrzhjPaoxmZdwF32fIxVgsmIxpzz2h8J1voyfHUSyDl2FsQT4s5eznhwVNb9AzmWjB0nHQ9z3Oy8eYB84R8SKiUBuXHCNSiA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730308262; c=relaxed/simple; bh=BGokR1rnVjyNDYabJSSa0k7Pn2ZZ9/4XWpf7LL38U1g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FL/ZNVqqmPOq47lOQb7iYBHylwgsK4NKn2mGEfqGOrRYOOIW+iw5G4m4rwz5B6vlepIGlxGLy4mket/Z1SZmraflDanccaIXbbZK1IVVZQC3vxONpzTCuHu9UPQqosGLy2ZAi83GpI/2knGaCdUK1mJ1QI4DPdVNyRkg1ujDnWk= 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=K8xYpAh4; arc=none smtp.client-ip=209.85.167.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="K8xYpAh4" Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-539e6c754bdso50179e87.2; Wed, 30 Oct 2024 10:10:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730308258; x=1730913058; 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=QTtvVILI8bASQzgU7LKCLSZFap6LNc4ft0tXHklb7n4=; b=K8xYpAh42zCPT785NmxE4p/qeoWnyMoh/Utcggki31hLCia3W3XT7hsQ93/euP7fwy GgZirnu5TAgDNEElj3cVKMH1rwcPDmBSqnE81DBLYyAZpB479CdFrxpc2OFxo6759pZX rs8QaOmvJYykf1REHMBOkUYIoOtZ19XuWr6uTd1h51ZFiYwST9k6TLewKLteQP78z0+4 1eyRoFdA4l0kon86l39qYJ2AhvDCJLtj/uDkvdG9ZzP2qehWYm9B4vc1n4oo3hxXf/RU l88Zov7/uTaW/x8aIN7gUEWAg+Rc7ypAD5+QvSS9Z2T4wzSfm4UNv84om2rtY9andVPe 4dvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730308258; x=1730913058; 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=QTtvVILI8bASQzgU7LKCLSZFap6LNc4ft0tXHklb7n4=; b=P+B3svGUd92HaYOr40xxakESynLs2AtQ83OXd4TAGFJmVsZbnfnU/B/ukXK/iHJxo8 XYhJDrprPbyQE1vmKMLAch/7HoSb9WKx5RftZ3RsSgy8z/aYfC5SwpAAHrpsLrJGdtS4 1k+TujsZNy2lSiQS1awsmXFglvmlcHLMtZ9J1eUudU2ZtBaARRy+SJgltYos4nUkU89d QQTRt9nhgTS2mGcdPUqFjX7xQUvbzRtunnlUWdl1O+Fc0ni4FzGoTi+d6jcxUoDoO12W 3eAMALFHrgmIKg8voxlupvv1cilPhBAlH62w8+zn7LJvsOFRXSp8Pd1eMUZ42oBuXCQi uMhA== X-Forwarded-Encrypted: i=1; AJvYcCWEl9IgaobWB+25yL0WwjlZEpi142lkAxFjBIxHNW4YvWKnTYrE5KV5gaW2almxUkDUu9VuD6djDeqHe40=@vger.kernel.org, AJvYcCX9GmxERJzAr+7uVn3qlMkISuhd9NWrtE70dGPX4inoh3R8O5pYqEfNZalyjgq+A/lOvzVp2/K3@vger.kernel.org X-Gm-Message-State: AOJu0Yx2mz9uJ54EJH4BMoxqU9xju/w0VOdU8FpV9N5DrwzN0JIpXpUN qKHq/wq+DpViSuDZ63zIjtZkfQDA+r5OVj6t6mNjyI5i2qWcq2RqoRp3Hg== X-Google-Smtp-Source: AGHT+IHss8st7QKvUSU+438ejEUHcCZ6cpwlHDkhixbeOiuY4PcEzYL4njnCgW9R4LX95uzpYmxAJQ== X-Received: by 2002:a05:6512:3a8a:b0:53b:4bc0:72aa with SMTP id 2adb3069b0e04-53c79e4d45emr165051e87.34.1730308257852; Wed, 30 Oct 2024 10:10:57 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-fbf3-0656-23c1-5ba1.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:fbf3:656:23c1:5ba1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431bd9a9faesm26828985e9.35.2024.10.30.10.10.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2024 10:10:57 -0700 (PDT) From: Javier Carrasco Date: Wed, 30 Oct 2024 18:10:44 +0100 Subject: [PATCH 1/2] drivers: soc: atmel: fix device_node release in atmel_soc_device_init() 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: <20241030-soc-atmel-soc-cleanup-v1-1-32b9e0773b14@gmail.com> References: <20241030-soc-atmel-soc-cleanup-v1-0-32b9e0773b14@gmail.com> In-Reply-To: <20241030-soc-atmel-soc-cleanup-v1-0-32b9e0773b14@gmail.com> To: Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Sudeep Holla Cc: linux-arm-kernel@lists.infradead.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=1730308255; l=1020; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=BGokR1rnVjyNDYabJSSa0k7Pn2ZZ9/4XWpf7LL38U1g=; b=EyUghQAPETz3hATWK388QYKXcL1vA578B0y0ZOrciW04D+dY7KkZeGs5utmBaPhjeySTFpXTv iBPlKCkpzAoBKbZ14G0RsDeSg5fKNv+gQVX98IvSej4UHKjivmxnCDE X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= A device_node acquired via of_find_node_by_path() requires explicit calls to of_node_put() when it is no longer needed to avoid leaking the resource. Add the missing of_node_put() in the different execution paths. Cc: stable@vger.kernel.org Fixes: 960ddf70cc11 ("drivers: soc: atmel: Avoid calling at91_soc_init on n= on AT91 SoCs") Signed-off-by: Javier Carrasco --- drivers/soc/atmel/soc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/soc/atmel/soc.c b/drivers/soc/atmel/soc.c index 2a42b28931c9..64b1ad063073 100644 --- a/drivers/soc/atmel/soc.c +++ b/drivers/soc/atmel/soc.c @@ -401,10 +401,13 @@ static int __init atmel_soc_device_init(void) { struct device_node *np =3D of_find_node_by_path("/"); =20 - if (!of_match_node(at91_soc_allowed_list, np)) + if (!of_match_node(at91_soc_allowed_list, np)) { + of_node_put(np); return 0; + } =20 at91_soc_init(socs); + of_node_put(np); =20 return 0; } --=20 2.43.0 From nobody Mon Nov 25 02:26:29 2024 Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (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 0E93B21A4D6 for ; Wed, 30 Oct 2024 17:11:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730308263; cv=none; b=TfUVyIBeO5GJ1wGwy9hYhO2iBLKyh5Kll1WDuLE2/2t9i9/4dhiOiA//Iky/Pqr2q/eki+yFJ213wIh4paLVLfSRJdXfmYZG+AEaxeWvDcTvO0llGv9mUUw52+8IBNQxT3tgMuJEqPMVj/cVgxNZGf4OSwzogJMfDbeIQ4oIrXk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730308263; c=relaxed/simple; bh=OndDXqKtEJ3cA9GTwb1q2oE8eowa7SIjG7xCrUy6/yc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iZwdB2luKzr+BJYVvvdtZSbhkRecJF0uBIpuiueqUYJjYm9F03/ganIhbLxmx5TqcaF8TuM8lpcbfD/pobbMZOKE56qIBOAtcMS/yNG+3wrl4GZfEIP2nDmXliEft5q8sOPBjHNOhV/z3/lxTrDcluWX10ZuKxmNUBLwz1UiLeQ= 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=YOB6Hy9Q; arc=none smtp.client-ip=209.85.208.172 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="YOB6Hy9Q" Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2fb5fa911aaso97325101fa.2 for ; Wed, 30 Oct 2024 10:11:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730308259; x=1730913059; 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=pJvO6m6VfJq7jLiXQGCAJ+rgJ6VzC5FKvl/I4BvuxQc=; b=YOB6Hy9QRfknjVIi4jep+E2t0gX9awKWmmaBdaf0z01ocmSDNk8hsGJsWaEWY/itmC xLIEvb6H7a1bh5qPgtXgJ7Ea5xiUASzFQqC6K/WPqUhyWudYk2QdK6ocfqtgNWFIzKtK dTbUjXFIgAe85dwqg1tGPTbDTKn9Ss2qGVEMEjY5MMnH7TjkBIoRVRze92HursCC313x u/opqCxRyKjfSayI9n1m3pTxnj8n+YfOT2Thhw6AJYUMP4Qrw5MwJMWuOwdFIkpIwO66 k1ZIcAPQiyMUpVcTpiB2jfL5LiBg9e3sSJPxxnDrV+sInnFpiAJUhbVdbhx2MxXDsu20 eCHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730308259; x=1730913059; 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=pJvO6m6VfJq7jLiXQGCAJ+rgJ6VzC5FKvl/I4BvuxQc=; b=r+6LcCQYof7ofJnwLoSqYxm/qmriNRPTBVkos2Xp/90RDIY61W6RtsIDhO03XTQYbl pC2lkV5Jy5LYVRAb/uTCSweFDV/Je/2LwEy4LEbFbSM9OIorInNTD4v1rg2LkwsVlpDJ 5lUkYBbbM/loa+j2vj+3H68KqsP9VObyjaYFnTDCgKgzSWVnJgIf/vHvf0O5GNaQFACM 4tBiKSxKkImO8RO69nT9B62QKAc/x6QoDULz9nTVBJuSscaoMem3zqvNn+2lXPkNrTSW jnh9vSBfmjXyUzUvNzK29Q8663cwcqceRh46hWwnWR7ZmBcjcqXUHLKoPFPbNv1tq/C/ Z86w== X-Forwarded-Encrypted: i=1; AJvYcCUS4w8tqSYzW3Zlbs6j02tu1llJ1SbC6VRm4x3lRcYuyrVX2b0PsFZSoCG4X9RXotQhJ9ck/6DX+hcpPcI=@vger.kernel.org X-Gm-Message-State: AOJu0YxdSvyLp3gWMp1Powubk0izw6thfIc+7NzrknE+q1g7QQm6immK uhPOl6sKI8i1XUkjtU2Hv6m+dGSRGkqRoRlCVF74cPU8v99PT0ze X-Google-Smtp-Source: AGHT+IE9t0eBimyH7UiH84hK6DgH1SFcaijILVkX0wzzcYM83S6LqN3c4d1isUuteAfU8x3BfYI/tg== X-Received: by 2002:a05:651c:514:b0:2fb:5206:1675 with SMTP id 38308e7fff4ca-2fcbdff1ffdmr135616061fa.27.1730308258955; Wed, 30 Oct 2024 10:10:58 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-fbf3-0656-23c1-5ba1.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:fbf3:656:23c1:5ba1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431bd9a9faesm26828985e9.35.2024.10.30.10.10.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2024 10:10:58 -0700 (PDT) From: Javier Carrasco Date: Wed, 30 Oct 2024 18:10:45 +0100 Subject: [PATCH 2/2] drivers: soc: atmel: use automatic cleanup for device_node in atmel_soc_device_init() 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: <20241030-soc-atmel-soc-cleanup-v1-2-32b9e0773b14@gmail.com> References: <20241030-soc-atmel-soc-cleanup-v1-0-32b9e0773b14@gmail.com> In-Reply-To: <20241030-soc-atmel-soc-cleanup-v1-0-32b9e0773b14@gmail.com> To: Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Sudeep Holla Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1730308255; l=989; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=OndDXqKtEJ3cA9GTwb1q2oE8eowa7SIjG7xCrUy6/yc=; b=4PSAgRDXw7LxIptekOdlnHv1UbgiZ5LgxiPU3wDfeyUAV/VockQb3gdRTkZabAt/nKdictWHL ZmQj0gg9UejBJkOLxrq5kpZ/MLBrGlreE1U+n05iRMIZ+vjHKy76MjC X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= Switch to a more robust approach to automatically release the node when it goes out of scope, dropping the need for explicit calls to of_node_put(). Signed-off-by: Javier Carrasco --- drivers/soc/atmel/soc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/soc/atmel/soc.c b/drivers/soc/atmel/soc.c index 64b1ad063073..298b542dd1c0 100644 --- a/drivers/soc/atmel/soc.c +++ b/drivers/soc/atmel/soc.c @@ -399,15 +399,12 @@ static const struct of_device_id at91_soc_allowed_lis= t[] __initconst =3D { =20 static int __init atmel_soc_device_init(void) { - struct device_node *np =3D of_find_node_by_path("/"); + struct device_node *np __free(device_node) =3D of_find_node_by_path("/"); =20 - if (!of_match_node(at91_soc_allowed_list, np)) { - of_node_put(np); + if (!of_match_node(at91_soc_allowed_list, np)) return 0; - } =20 at91_soc_init(socs); - of_node_put(np); =20 return 0; } --=20 2.43.0