From nobody Tue Feb 10 09:58:30 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 9A3942135C5 for ; Sun, 28 Dec 2025 17:20:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766942445; cv=none; b=fQD0lBnIZ8fHtR1fMMpKFDfrUTlujdCccrn2CX6wGXpUo462tG4RzpeKct+UvyscMsnw6bOOHBAlH2pPwNlg0QoV3Br7U2sCo4WjZAw1ndE87An8VS0X0q8ve48EKdhHCUPKX2T1hdc3XSsFzQOTmVZuNZmdrQBxhT/kZcbJ6RI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766942445; c=relaxed/simple; bh=rk/o3/dn1oyoyEh9/h7QN6VQvqM1qIx8S8Xwn8+Lv1A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=f7zlQFYftbaaFE0kF+TtbU4o/xVCrvPTAMjT2dJSLcopqzw6FSHT3RoBua0Y/+sKJ8r6rH2qw1oCwXRa4JaWENHyFDkNxym3Pn5CuI+G52hKXlxjTr7TEetvEXEwWqmWEqStDUM/jEGYeuOgqOaEe9so9yN/kvDAq5fTm0ft6+Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=CsAEIi+H; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=fG2ZVz8H; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="CsAEIi+H"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="fG2ZVz8H" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5BS6I4Bj3631972 for ; Sun, 28 Dec 2025 17:20:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= Ncyvah5e5r6XDWMSFFSo1CfTUNq2hV3TRvAvXWzPgXY=; b=CsAEIi+H4I3xtisP SoQ/SvYTumEBaxTPnC1xk/lGc/cyHA5yP+3+stHCh5YICgohzQNOXA9F8TCxOc4N c/SFAuYmsfe4GBrQsN/xYpNLiktvDnUH1KzCinrosKElrqUTFzYNv+JiSpIs5LOC 4jAejny4jY44qNyPsjEy9N3LKPcX6gNnGMKN30RO0OQq+fAFxCeT/GlFiHnC2I6u JIzjjcyUHJY+Po8tEe0jeOpmmSZCvmuu1z0uAngx2XjErYkAK4Qo9WRhfj/NOePB Uq2rUnnKj6I+5un11dfCYfuF+ypfMpLFT7DQr28f6hfSiLUXsYp6x84IEcQXwCrb FBStqw== Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bavrj0w6q-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sun, 28 Dec 2025 17:20:42 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2a0f4822f77so238550025ad.2 for ; Sun, 28 Dec 2025 09:20:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1766942442; x=1767547242; 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=Ncyvah5e5r6XDWMSFFSo1CfTUNq2hV3TRvAvXWzPgXY=; b=fG2ZVz8HAWIZEwUXjryVtHODQoQivGUP84GYO+fbrjfTzXbZYHrxqd2oBngwmKBR3j AQG70EBYVUSYSsbmQ6Nd1LzCE7GU1qvpVHdSQkMpIehOt+u+zDjl+ydTAAISBJYXnlPA iTM3t3yZh5p6V6wMZPMDQI6Pl3NH1MWoOezN2e5uq832UlgDoC7T+BwmqBw+IoRemRee gCB0zEmENEKrOy+o/JtqhGJaAwQDmiRj8upPHc6b6H0e3Wq74SD6SEOCJL0kst+cWvvz n5O4IDCFiOExNrNZ1fczxi0hGp2RNhT0C0bFsQxQT/j/zw6UPXAHlu6w56s5l4eJo5+k Ad5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766942442; x=1767547242; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Ncyvah5e5r6XDWMSFFSo1CfTUNq2hV3TRvAvXWzPgXY=; b=p/QJO+1r4cf7ZwLx/RQiVUBL7N0JkysL3rxKvFwncnTsaMN7yzAa0NsDsj4JmtlJ5d Qxn6Ezaenjyq1Al7YnfyNvD8gi2jIqTVD3Vd46ERNq21Zdqtz4s8frJZ3YygfpujB1L3 hi3FPgpMwr1Rw/2K/8O5HVA96z/K0eZNwuJ9PjrpLjFLbriUEDvxm4iXMB7ueQZgAZ18 YM7v2o8MoGtQ2DKE05kTnUsicRZSJQXJMOa0EmiCX6mKrRsSYenAwgDQ7G9uuqSearm8 ryhhGFumQv1jv8Xsu6p6Z/K6gAJPvOgGIWjIAYZouQcwONqk48A9MOLsu5FOBZRkPw9+ uA9Q== X-Forwarded-Encrypted: i=1; AJvYcCV7iwYZhuSPlbDdAzg2yOWYV9EP9iAq5TnY/6NaCQJ9oZiep6EFTcrzVCRILvsqjnJk8b4ay1CgkJHO9lc=@vger.kernel.org X-Gm-Message-State: AOJu0YyyHwg984Ic+vRZ7eNxt7z+qIzQLc5bodhRs02oX5H8Nos6vVSw TcYTIsjz17ERqtYoKZQyMTKfSxMudxPWFdEzJzjbnp3NyQCK7IGnqtPE2tROJ2ETAeXJ6WFxcmh xOjMmdDBqEtITsrjRCnP5S7YOFRQUIB60vSe+SL4rSRr/xOndyBxEwUkVRFbmYjdK8p6V91d0C/ 8= X-Gm-Gg: AY/fxX69R/vAVO4aNJREm60MpJvT0RKJIPplfDMf+yscyTwsM0Ae1rjoHTOb/oYj6bW RrgmlKpRA6zlrPOulJR0lTXktq5Tlg3xisaeJsMU0cE7q0XDCbt6AFAvV9t0cLfAfDYIwk4JS3G PAw8X+d8mSPo73arMPZS4ZrziPTgz/uuK5xoVZsdyiaT/EqVDtlX4/e7J29adsdkKkj0VYrpf/N SnvKA8ZII9uq7X3o4CWWRn9rj9nL0zXpPDnnFhMYlxC9qWWuHaRltXJkzIytwsQjwsnnE2qKKJ5 wEtvPVpuKYNhzRmKwAoYTR/NV0gg6i4OksPdUmDEJ2SOGUnGaIarxUPAsq3dGqDCcUbjwadlw3H 1zAWAgDYKcUNOIFnF7YWd8Ses6WswDfRtGl21hTqZ8xvpFQ== X-Received: by 2002:a17:902:ebc8:b0:2a3:48ff:32df with SMTP id d9443c01a7336-2a348ff336fmr203369135ad.57.1766942441875; Sun, 28 Dec 2025 09:20:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IHN95+Mh2TIq2sK2yELjxg5pJShOwNEfi8iqz115YSh9XEjuzYEa3oHJxrcZLIHspPckdDAJQ== X-Received: by 2002:a17:902:ebc8:b0:2a3:48ff:32df with SMTP id d9443c01a7336-2a348ff336fmr203368615ad.57.1766942441364; Sun, 28 Dec 2025 09:20:41 -0800 (PST) Received: from hu-spratap-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a2f3d776ebsm255743965ad.99.2025.12.28.09.20.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Dec 2025 09:20:41 -0800 (PST) From: Shivendra Pratap Date: Sun, 28 Dec 2025 22:50:19 +0530 Subject: [PATCH v19 01/10] power: reset: reboot-mode: Remove devres based allocations 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: <20251228-arm-psci-system_reset2-vendor-reboots-v19-1-ebb956053098@oss.qualcomm.com> References: <20251228-arm-psci-system_reset2-vendor-reboots-v19-0-ebb956053098@oss.qualcomm.com> In-Reply-To: <20251228-arm-psci-system_reset2-vendor-reboots-v19-0-ebb956053098@oss.qualcomm.com> To: Lorenzo Pieralisi , Arnd Bergmann , Bjorn Andersson , Sebastian Reichel , Rob Herring , Sudeep Holla , Souvik Chakravarty , Krzysztof Kozlowski , Andy Yan , John Stultz , Matthias Brugger , Moritz Fischer , Mark Rutland , Conor Dooley , Konrad Dybcio , Bartosz Golaszewski Cc: Florian Fainelli , Krzysztof Kozlowski , Dmitry Baryshkov , Mukesh Ojha , Andre Draszik , Kathiravan Thirumoorthy , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Shivendra Pratap , Srinivas Kandagatla X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1766942426; l=3746; i=shivendra.pratap@oss.qualcomm.com; s=20250710; h=from:subject:message-id; bh=rk/o3/dn1oyoyEh9/h7QN6VQvqM1qIx8S8Xwn8+Lv1A=; b=WE4KkMlDQE7y1M5MuyPJ1J7DZ5mg6wAYvAt8IvFE22WMA3CeJgkTNkCcQPVJBpH5LcUfAa3Tt df8S2bPCksBC7ZHZmNVMKfghCx06BAEc/44PoXkkmPTb4hFQJGCixP2 X-Developer-Key: i=shivendra.pratap@oss.qualcomm.com; a=ed25519; pk=CpsuL7yZ8NReDPhGgq6Xn/SRoa59mAvzWOW0QZoo4gw= X-Proofpoint-ORIG-GUID: 97uFyBOIibhMOk12Nd31jjcqiSdigMMJ X-Proofpoint-GUID: 97uFyBOIibhMOk12Nd31jjcqiSdigMMJ X-Authority-Analysis: v=2.4 cv=coiWUl4i c=1 sm=1 tr=0 ts=695166ea cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=QIdouwm7mKRySFGJXRQA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjI4MDE1OSBTYWx0ZWRfX/RcvS07thcPP NCBupaq/9MPR3KrUI4tpaXJDJTcfni1V5p3jQH9diWFBUC+vK9GlNV7Ysvj6rRLS2tuX0NtXP7E OiHy77GkzEt/s6Of75DHKFVFRmPKbexpGrBkOYNvbCQsf0LSI1sfCfvSdZKzmdzkXvMWq/lv7wb bvWlOqJIRJBXw6HqyZZqz5/hHx4O/mjxffUpd8ZeZoTO0cwZkEx9dH1kThDdpk6GH/o+qfDewZ+ bXWC3bQXAs4eI71TEi7JocjoaS+oHdAr3t2ydEInFIGK2z2QkYmxwNbtOVHLRHXf4yt4YOvPynb FWPwShIdpcEGKF/+GYuj6lVPJfMbUNOBsNikgf/z7AUhYf0X7fVLqilfj5LaTHoCK+rhrccqGWv 5bmV2bb59Y4dYpHaWXLLnfxb1yaKQf2bo/zAm2z3aWDd63Ax30Wwwf1NKvBzqf1Y/r8Yi/+cFVm 5OnPqHUis/DQpa6tYWw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-28_06,2025-12-26_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 lowpriorityscore=0 bulkscore=0 clxscore=1015 malwarescore=0 phishscore=0 adultscore=0 priorityscore=1501 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2512120000 definitions=main-2512280159 Devres APIs are intended for use in drivers, where the managed lifetime of resources is tied directly to the driver attach/detach cycle. In shared subsystem code, there is no guarantee that the subsystem functions will only be called after a driver has been attached, nor that they will not be referenced after the managed resources have been released during driver detach. To ensure correct lifetime handling, avoid using devres-based allocations in the reboot-mode and explicitly handle allocation and cleanup of resources. Fixes: 4fcd504edbf7 ("power: reset: add reboot mode driver") Signed-off-by: Shivendra Pratap --- drivers/power/reset/reboot-mode.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot= -mode.c index fba53f638da04655e756b5f8b7d2d666d1379535..3af6bc16a76daee686e8110b74e= 71b0e62b13ef8 100644 --- a/drivers/power/reset/reboot-mode.c +++ b/drivers/power/reset/reboot-mode.c @@ -3,6 +3,8 @@ * Copyright (c) 2016, Fuzhou Rockchip Electronics Co., Ltd */ =20 +#define pr_fmt(fmt) "reboot-mode: " fmt + #include #include #include @@ -10,6 +12,7 @@ #include #include #include +#include =20 #define PREFIX "mode-" =20 @@ -71,9 +74,11 @@ static int reboot_mode_notify(struct notifier_block *thi= s, int reboot_mode_register(struct reboot_mode_driver *reboot) { struct mode_info *info; + struct mode_info *next; struct property *prop; struct device_node *np =3D reboot->dev->of_node; size_t len =3D strlen(PREFIX); + u32 magic; int ret; =20 INIT_LIST_HEAD(&reboot->head); @@ -82,19 +87,17 @@ int reboot_mode_register(struct reboot_mode_driver *reb= oot) if (strncmp(prop->name, PREFIX, len)) continue; =20 - info =3D devm_kzalloc(reboot->dev, sizeof(*info), GFP_KERNEL); + if (of_property_read_u32(np, prop->name, &magic)) { + pr_err("reboot mode %s without magic number\n", prop->name); + continue; + } + + info =3D kzalloc(sizeof(*info), GFP_KERNEL); if (!info) { ret =3D -ENOMEM; goto error; } =20 - if (of_property_read_u32(np, prop->name, &info->magic)) { - dev_err(reboot->dev, "reboot mode %s without magic number\n", - info->mode); - devm_kfree(reboot->dev, info); - continue; - } - info->mode =3D kstrdup_const(prop->name + len, GFP_KERNEL); if (!info->mode) { ret =3D -ENOMEM; @@ -102,8 +105,7 @@ int reboot_mode_register(struct reboot_mode_driver *reb= oot) } else if (info->mode[0] =3D=3D '\0') { kfree_const(info->mode); ret =3D -EINVAL; - dev_err(reboot->dev, "invalid mode name(%s): too short!\n", - prop->name); + pr_err("invalid mode name(%s): too short!\n", prop->name); goto error; } =20 @@ -116,8 +118,12 @@ int reboot_mode_register(struct reboot_mode_driver *re= boot) return 0; =20 error: - list_for_each_entry(info, &reboot->head, list) + kfree(info); + list_for_each_entry_safe(info, next, &reboot->head, list) { + list_del(&info->list); kfree_const(info->mode); + kfree(info); + } =20 return ret; } @@ -130,11 +136,15 @@ EXPORT_SYMBOL_GPL(reboot_mode_register); int reboot_mode_unregister(struct reboot_mode_driver *reboot) { struct mode_info *info; + struct mode_info *next; =20 unregister_reboot_notifier(&reboot->reboot_notifier); =20 - list_for_each_entry(info, &reboot->head, list) + list_for_each_entry_safe(info, next, &reboot->head, list) { + list_del(&info->list); kfree_const(info->mode); + kfree(info); + } =20 return 0; } --=20 2.34.1