From nobody Mon Nov 25 09:40:46 2024 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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 B99AD13AD11; Mon, 28 Oct 2024 17:06:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730135209; cv=none; b=c90At8SI/f/xFkTgeMDwfA1yky9xhXV21j5hmSWvCqCJQTnl7tPOcJVDoUmahXWRaOwJTPkH+K2PmzO8i+AWoU2YHQDVCbN40puaT2G6IG/pLRPjs8dsjAELj3vt/xl0eSZNUPauVZ2PAVTwIsc2gFKQkVUKZ1sAPHHt+sTVkGM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730135209; c=relaxed/simple; bh=hSFWp27IFs8R/mtXYTZDTyF+KDUDuBjLR3DwK1+aO9E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=U9twJSH7HpR/pp/hzHXUNFgKcQ01h9R+98wl9fFbbLR0nwr34d9dqEqicX/EtFx/Ov2uouULPr/dlUfBXwdHPoaEzq783Hj+4G1KSmYjSd86zv04ueJTd+TL4UPCw3BQse8EozGSPcjNGQ+2i+0lSMG/c2umGJJ25L3GZT6V8fs= 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=UC3y/4B7; arc=none smtp.client-ip=209.85.221.54 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="UC3y/4B7" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-37d4d1b48f3so3378709f8f.1; Mon, 28 Oct 2024 10:06:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730135206; x=1730740006; 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=O05QR5jut87q0up8QxTT54jxN1Q5tSHRGwMyYGGlNAQ=; b=UC3y/4B7qh0JyQ3JAWgqdcIwB8U0pTWJQDgbXG1ktsIarQkNzx1jjYoANKw+4O20D3 CMc1c2Ms3sAuzE4tnkre1AI9+N3j3jT9HBmSs+4Nf8kKXfW1srJiRUiaIhfq6lzjJvk4 hthUwC16MawfJR2VaPUhVRUdVnGOSyZQK7viFihQFiBh+dEWaKYBSEhfVM4p51hOmtAW +fjmV07qU4uP0emhSfICQajRUMJ73nB9c5jXFrrNIgA5i/FOcG5oiGkGC6TxC09AyubU EUGCzGEOtyhBGFlhBebMIB7LSmwjrWVwtsEDBidcrhsJFhKrh9LqWSwJZhIYJ+KMdZnR bcAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730135206; x=1730740006; 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=O05QR5jut87q0up8QxTT54jxN1Q5tSHRGwMyYGGlNAQ=; b=jndsg287MClZlnyydkEv5iffwDVLetHNBhbRPW+GMZf1Vw7JEdAkgnuzEQFnIjFSuN bWKf6B+sOpikO9mN/VK2WIv5ovi38nPBXzX3oF8yszxTZrINJZkNMMB92RUK7kkYyVzq wEot1KxVffZLiFeJyGo0hue7yunxXM46S4jG0N8Ewf8UMCd1YsuhmTYAJejaqGlftyde eRFm02XaZG9FiU/fGYLJtZ8oDcJlcjb/HT6NSek2zozApjrqa1YxXtUPMdolbgQFs5aO ACTEtdfYscq5+zR7bj1h9KYyOQoHIG74fAPKZriVds391WTGBTsaS1plPHkKbPh/a7Eo tkfw== X-Forwarded-Encrypted: i=1; AJvYcCWpZPW+4vGPPszw9NqAqVVDp6dwjNMR0VG6TVMlSq6nBZs/Evp3pEB/oUNZognH56tcV4tjjxU=@vger.kernel.org X-Gm-Message-State: AOJu0YxLqXhOYSg/vDaRnO9MDnocUanRFVTx4SRsNEv22tsj6rb1fxUL t+MHgnICmAhLUQzK4EAnDzTL5GkoxIl1YpU85BqMlJonwLTg/kP29zDIgg== X-Google-Smtp-Source: AGHT+IGa1uhTEJFoxnQBiuZRd5TCVIlWMs8Q6pstlSN3rogDlsUEsdrtJYdkP1xqZNrNL8psxveD/Q== X-Received: by 2002:a05:6000:1:b0:37c:cca1:b1e3 with SMTP id ffacd0b85a97d-380611dcb75mr5913150f8f.41.1730135205833; Mon, 28 Oct 2024 10:06:45 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-b273-88b2-f83b-5936.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:b273:88b2:f83b:5936]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38058b1323bsm10089732f8f.9.2024.10.28.10.06.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2024 10:06:45 -0700 (PDT) From: Javier Carrasco Date: Mon, 28 Oct 2024 18:06:42 +0100 Subject: [PATCH v2 1/2] clocksource/drivers/timer-ti-dm: fix child node refcount handling 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: <20241028-timer-ti-dm-systimer-of_node_put-v2-1-e6b9a1b3fe67@gmail.com> References: <20241028-timer-ti-dm-systimer-of_node_put-v2-0-e6b9a1b3fe67@gmail.com> In-Reply-To: <20241028-timer-ti-dm-systimer-of_node_put-v2-0-e6b9a1b3fe67@gmail.com> To: Daniel Lezcano , Thomas Gleixner , Tony Lindgren Cc: 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=1730135203; l=1295; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=hSFWp27IFs8R/mtXYTZDTyF+KDUDuBjLR3DwK1+aO9E=; b=2WgFXXCVveFXjC4UEs/m3Aja//8HRNHEHDCSX8+CqiQIu8rShgEEodvNYiXQCD4s1ZcnTKOJE X5jzJDEbodgDXA1SKaJdvVY/FgCUTQt8zFglztTTpDEmcJT9ZwBe0TC X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= of_find_compatible_node() increments the node's refcount, and it must be decremented again with a call to of_node_put() when the pointer is no longer required to avoid leaking memory. Add the missing calls to of_node_put() in dmtimer_percpu_quirck_init() for the 'arm_timer' device node. Cc: stable@vger.kernel.org Fixes: 25de4ce5ed02 ("clocksource/drivers/timer-ti-dm: Handle dra7 timer wr= ap errata i940") Signed-off-by: Javier Carrasco --- drivers/clocksource/timer-ti-dm-systimer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clocksource/timer-ti-dm-systimer.c b/drivers/clocksour= ce/timer-ti-dm-systimer.c index c2dcd8d68e45..23be1d21ce21 100644 --- a/drivers/clocksource/timer-ti-dm-systimer.c +++ b/drivers/clocksource/timer-ti-dm-systimer.c @@ -691,8 +691,10 @@ static int __init dmtimer_percpu_quirk_init(struct dev= ice_node *np, u32 pa) arm_timer =3D of_find_compatible_node(NULL, NULL, "arm,armv7-timer"); if (of_device_is_available(arm_timer)) { pr_warn_once("ARM architected timer wrap issue i940 detected\n"); + of_node_put(arm_timer); return 0; } + of_node_put(arm_timer); =20 if (pa =3D=3D 0x4882c000) /* dra7 dmtimer15 */ return dmtimer_percpu_timer_init(np, 0); --=20 2.43.0 From nobody Mon Nov 25 09:40:47 2024 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (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 856EA1DF269 for ; Mon, 28 Oct 2024 17:06:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730135211; cv=none; b=uWncB44hnnPxKdhYVRZcHOU9fmJy28CiNMQ/OCmtemekdMhHPn6+6eOoRFyvHI70plg7Ra3sVTassrCpB4fZVMWYOtu3LVNG3WySKb5YTXYGxOl4pgmtWZrc9DJ05f4tChKR150GVLhalHz8SdDce5KDmYLpDkr5xx6KrapyeEU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730135211; c=relaxed/simple; bh=sGBArxVersbstljICqTdSnJ/96WvUJM3UavZUhrJjdM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iPZyRHSknek9j1ymC7IKTM1qrOnsJa/MuvZMCwRWIfI795T69BxZ/dBuBJDV4aNkc9r08ja2z9bHvOgyRqjG/9IzJwXibhY8ZHBv6qqB4M6Ckd07aiqZ5iqzlym7pro4d7S4EoJkZEq028volxnozlnCYdOfPQ8/sNB+AXVzsyA= 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=EC2AYRYF; arc=none smtp.client-ip=209.85.221.48 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="EC2AYRYF" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-37d4ba20075so3150206f8f.0 for ; Mon, 28 Oct 2024 10:06:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730135207; x=1730740007; 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=pm5hKqutRtVQvCC9MS5vBGgI9yFrJ3Mk+QkNmCnD9/E=; b=EC2AYRYFdXFptYav+eNPXVXEVkNuIeFRm97namlZLRzbZNz6RzaAfUoAy8q4UYjhB8 qczmv74FnufezaUvS15e4e/NyKoBKQLJRnNpQ0X4EmZUbshQ18170/D3JFBWCv2N/i+j VXt73zcuQzbeHzb76B+eCbKkEFZxnQc5Gu3JB3+6vVcS6y6s9WlvgnOATMZULSYRmFo2 eQ28u3nA64XiRFF0ReLXT4pQgaE5waP0/A5eeg7KWEKOPodfCpYm0jVf791fjeuIjarO CbB4Bh6QtlfSoAF4FvTjyG+sCCh4CuThJkhKGX0fHnteghdDe1P0ihSx59o8ADaB7KVe YudQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730135207; x=1730740007; 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=pm5hKqutRtVQvCC9MS5vBGgI9yFrJ3Mk+QkNmCnD9/E=; b=wSd0sZpUIv68BxOi+efqphM3shLxxA9EQXo92UeV0Bnyy+l/iH9a9FCGTtt2fGIMzV IeJYo9xS3LZEWy+DMtzl6AHbLoCq7ATARhwOg0MLpE9YvGLbyrGrHqhB5ZOg8kqmkuC8 Rx55qff09S7QpvJBYbhHV5BrpQ1JvBgWhsHByZ9w+RQOphRky03o/GFx5hY7YceUYLi2 LUh0MXrcMGX3lUO7NGMeAVVyfhdDwwTYD5bDBOTqLLmz9VSqyACXUo9rNmm60ze5I2H2 IvtMLa9LwqMUN8KOs+TXIuou6luYnsgrIahqgJexY1fT8OgWaCA7LVr/sS40m5Y2IMIl 85Gg== X-Gm-Message-State: AOJu0YxGtmUReQMGl8tJYwO3nYRYpImck8snsjV+hA/Vm6c91H5rcdLS QrVNvMNy6p8eaHwotbRILbnjDIIfRpjXx7YwxB7QOIs4pMzFOltktNtwcQ== X-Google-Smtp-Source: AGHT+IHsjPiri0coXT6MHNA/rX9gGKsPP2NkkI5d6G1LyBN1HIpUgjHjNBNbfFpR7u9dqmGjfRFt6A== X-Received: by 2002:adf:e28a:0:b0:37e:f8a1:596a with SMTP id ffacd0b85a97d-380610f4d3emr7007489f8f.3.1730135207207; Mon, 28 Oct 2024 10:06:47 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-b273-88b2-f83b-5936.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:b273:88b2:f83b:5936]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38058b1323bsm10089732f8f.9.2024.10.28.10.06.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2024 10:06:46 -0700 (PDT) From: Javier Carrasco Date: Mon, 28 Oct 2024 18:06:43 +0100 Subject: [PATCH v2 2/2] clocksource/drivers/timer-ti-dm: automate device_node cleanup in dmtimer_percpu_quirk_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: <20241028-timer-ti-dm-systimer-of_node_put-v2-2-e6b9a1b3fe67@gmail.com> References: <20241028-timer-ti-dm-systimer-of_node_put-v2-0-e6b9a1b3fe67@gmail.com> In-Reply-To: <20241028-timer-ti-dm-systimer-of_node_put-v2-0-e6b9a1b3fe67@gmail.com> To: Daniel Lezcano , Thomas Gleixner , Tony Lindgren Cc: linux-kernel@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1730135203; l=1210; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=sGBArxVersbstljICqTdSnJ/96WvUJM3UavZUhrJjdM=; b=8ramxzmDzxPSEY1BZUw7Zq3nb9FouHrp6waafExkIyUhM1BX0DtjgOUofDHtcv5exDpyfoY4F rzvkMKloB8EDMPhQRIo4aBkoJI3CPkDzNaxfcx4brtE9x1T8tv2nmmk X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= Simplify the code and make it more robust by automating the node release when it goes out of scope. Signed-off-by: Javier Carrasco --- drivers/clocksource/timer-ti-dm-systimer.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/clocksource/timer-ti-dm-systimer.c b/drivers/clocksour= ce/timer-ti-dm-systimer.c index 23be1d21ce21..d1c144d6f328 100644 --- a/drivers/clocksource/timer-ti-dm-systimer.c +++ b/drivers/clocksource/timer-ti-dm-systimer.c @@ -686,15 +686,13 @@ subsys_initcall(dmtimer_percpu_timer_startup); =20 static int __init dmtimer_percpu_quirk_init(struct device_node *np, u32 pa) { - struct device_node *arm_timer; + struct device_node *arm_timer __free(device_node) =3D + of_find_compatible_node(NULL, NULL, "arm,armv7-timer"); =20 - arm_timer =3D of_find_compatible_node(NULL, NULL, "arm,armv7-timer"); if (of_device_is_available(arm_timer)) { pr_warn_once("ARM architected timer wrap issue i940 detected\n"); - of_node_put(arm_timer); return 0; } - of_node_put(arm_timer); =20 if (pa =3D=3D 0x4882c000) /* dra7 dmtimer15 */ return dmtimer_percpu_timer_init(np, 0); --=20 2.43.0