From nobody Fri Apr 10 02:40:04 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 67C0C3DEACF for ; Wed, 4 Mar 2026 18:03:37 +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=1772647418; cv=none; b=FUWqVr39JSRvy/tZrtL9Z+sGoUz04WALT2bgFcS8igr8QN6w0zQJabc9XizauEaMNWdCya6MNBna/y33tL2sDvYIQezmbv0AMWAX4QAG+S9kDYXc/DLWiro4OUS1wK4OL6FkAoMlg65GU3iOQLVQv4j2BLwDp2XGBjDwcpM5Hc4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772647418; c=relaxed/simple; bh=nI413mpH4Vny/jDMl6dShEe8rWIdtCh49blRabGf3jA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=komBIZB9Pg9ExxgoKCNPzBb1ADIr4Z/mSCFc87KvbskXwiSds24I2twcLhZ/F/iaZsmKbeWedeDox1RiPN6yKFFYsqlFAKB4L2D1ldWaPEVfqhMMNSXA0UlZe6IKseJotXJQqTbNp6K6RBjsK0N8738ecmm1Fi/noIfux3cB0Ps= 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=GTl/xsZh; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=h/313gp3; 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="GTl/xsZh"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="h/313gp3" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 624E0chc029451 for ; Wed, 4 Mar 2026 18:03:37 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= R3mGKt2hZAc1/fLOvPOaHv4o+LhU4pbbCYTJr7cvoC0=; b=GTl/xsZhfZm+uECM Cdv2UOoxCyv/FNB5aHi0HOMmTs/tdFSMn+u+2HlMSZcdsQsaoIGdoXX5CUfXM3nU RbuKM5FoBt/MY9FodKAiOT3Ah8/frxa4ewWsP1Ve14Ud9k3gXNQsP6GWTVnyDQcs r9RgSDhnO/yaIaP8RdeB03NzWHdqxgVyZIDzKt3iqly4GvRVRVHPf8htg6/lT9w4 q9L5smyFl9f/16FvcbSpURF7f6MZdvGmkXeZNv+ktHQipQHeonV3fQ4QWt3tUEqp ePM72MVA3rFC8+Ivu/UGmegFrg6voFc11bgULVPnMY/O86SEOUY5SQFRAT9sK9Vd 8Rw9kg== Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cpp4fgv0a-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 04 Mar 2026 18:03:36 +0000 (GMT) Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-35449510446so6739913a91.0 for ; Wed, 04 Mar 2026 10:03:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1772647416; x=1773252216; 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=R3mGKt2hZAc1/fLOvPOaHv4o+LhU4pbbCYTJr7cvoC0=; b=h/313gp32WINqznyLbeaP1Qi0hOHQNX3HBWS45oPsG0S77qSQdWQhRXoXWQKwo19eM EhNsGGPFjBTNKqRbF80qStnAyXkslP2SLbitglbt3oV0uH4v1G7bPFLfaqNgz2jUjSVE SnUWBnI14CHFJAtV1K+HexiWDTcizXsQgCXell7+TR73hlx1TcKIzsLISQycVKHZWs35 AXpPnZM9tmAOGg0ZJG2eenGkEj3SDz4LD5SQC4Yv9vgWTJYM9hf1aLYY5HvMxxhHRpbv mYQ5w0IQr1TKYOfVr0w7lsSNTf/RzBM2eOsNbngyTZASjzlYJKb7ZSUxH06ZrK5v5fnw VOrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772647416; x=1773252216; 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=R3mGKt2hZAc1/fLOvPOaHv4o+LhU4pbbCYTJr7cvoC0=; b=E91+uveD5lz2YFbL4JZryTjKdx+OYEvwt/DsE/ek4K+FRUw/FfxuZW9tvJDlo78nVJ 1PE+wwJT4FCvHp2tQtNER26t1YEM401Xt3HUy7/DU1gkJHjWG+hgiP7/jSOFjowkw79N s8e5F62jOOfd3fv1L/Iem7kIs2gqppkEL+4tcvX+amV6Z/UZEBD2T+r+cwo5PDGdmpxw IDPIM1Qo2Qktkwc4esHTF92Z3F8tcA1ZaLTRzRKNqepLHNRlCqb0+Xa+xOtjco3A5T4L yAW7vZdf8ReLUcqaytGIy8QlnEH8QzcaPFWFiNrwNbbMq0XfLppQVIiUEAAz0zVy1vly /gMA== X-Forwarded-Encrypted: i=1; AJvYcCXI/01C2FdFbpuikIiUyZCVcM4KrzY4qJQK44HaqAS/oind5HvMU4u/xB6kJUH0pBmMAMJKLc0Y75jsm4Y=@vger.kernel.org X-Gm-Message-State: AOJu0YxVWrfDOjEolfRGtGyuZ8uSDnESFxInBs6uqhjR/jPgX0aFXoZC UTnD4wo8qTXf3jcijjj6AtgwaHxZmEPcg4PxNOxqpfzssSPUaEUvryTosufgyEXi+z6BNX4Rf68 EsYqiWTF9Z+I7ZPfgkVgNhZqiqajM2IT+QC49MrDoXtjHeAwip+iUM8ZzpED2/g4beCs= X-Gm-Gg: ATEYQzwfeUccK/YqqOj01uLVtdeIjm1qcWSfrwdUBoD58+TlQG7j9HWBWoDQ/tdXuWo c9vqKcMTyplZvqSK3nwcdRPRQdbVJB8k/Vd4xzxOaXuHELYyrSTU5ijI3MS6M7RAFZ+sLcr3vgn Pf2BIZxNOwMSvst4UlS9Jdj0AzK/QdqIUS2kuX0NHmcpvbEKhkxqqPqyHGyXepbxIrLsTpIfujC bfNZluG4nNxcZp/IxWcj1vKFnzLx3psG8u8olH+9PgCoge1s3Q7VWgq+Tm+aacpwXWehHQev1v9 kLU+H986nFAVHKhDHRf8O37E4T4aWXZAtDvG0v4CjvloNO9w8gLTIZqRltrID/t+SEw1NIXsKHv 0nad+3Vh00HCSiG03PvrZeeSyGe71bOA64uUtNHK1Byi68mgIeROpLsOM3Q== X-Received: by 2002:a17:90b:1e0b:b0:359:2d1c:9206 with SMTP id 98e67ed59e1d1-359a6a97876mr2870327a91.33.1772647416118; Wed, 04 Mar 2026 10:03:36 -0800 (PST) X-Received: by 2002:a17:90b:1e0b:b0:359:2d1c:9206 with SMTP id 98e67ed59e1d1-359a6a97876mr2870305a91.33.1772647415618; Wed, 04 Mar 2026 10:03:35 -0800 (PST) Received: from hu-spratap-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-359a8f22062sm1080606a91.1.2026.03.04.10.03.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2026 10:03:35 -0800 (PST) From: Shivendra Pratap Date: Wed, 04 Mar 2026 23:33:01 +0530 Subject: [PATCH v20 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: <20260304-arm-psci-system_reset2-vendor-reboots-v20-1-cf7d346b8372@oss.qualcomm.com> References: <20260304-arm-psci-system_reset2-vendor-reboots-v20-0-cf7d346b8372@oss.qualcomm.com> In-Reply-To: <20260304-arm-psci-system_reset2-vendor-reboots-v20-0-cf7d346b8372@oss.qualcomm.com> To: Lorenzo Pieralisi , Arnd Bergmann , Bjorn Andersson , Sebastian Reichel , Rob Herring , Souvik Chakravarty , Krzysztof Kozlowski , Andy Yan , Matthias Brugger , Mark Rutland , Conor Dooley , Konrad Dybcio , John Stultz , Moritz Fischer , Bartosz Golaszewski , Sudeep Holla 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=1772647398; l=3628; i=shivendra.pratap@oss.qualcomm.com; s=20250710; h=from:subject:message-id; bh=nI413mpH4Vny/jDMl6dShEe8rWIdtCh49blRabGf3jA=; b=tmuPFucdwo0CFgiVjaW74q0jpCSADUah6j2tcoEU889L00rSI3hCZWyRg9lYeuJLkbzcgUbMl lLhJoaewZdSC5aD3/VNXRx2t/86PDFYYBGaT//NQg9dHrzNMmUC8aZ3 X-Developer-Key: i=shivendra.pratap@oss.qualcomm.com; a=ed25519; pk=CpsuL7yZ8NReDPhGgq6Xn/SRoa59mAvzWOW0QZoo4gw= X-Proofpoint-ORIG-GUID: jCK8jVLd34XrZAlbAwKvKz4KH8W0yCYI X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA0MDE0NyBTYWx0ZWRfXw2OBUfSyx6Vu rPu3rnHlkMMptGoT6jUv2FVewERkWSfFQuaUBJ+A2zg09djVXGRBFmFD1A4WLpbwxDkD2aq6hgd jmchqhqiY8SIQcHIXc84WUtulpWx8f7gGDGavjcqxfKvCcywxJaDflSjNODrgW12urXqL8L3h29 KsXeWe8Q0v6rFCl+vZJLZbOvHA0CdNnQENqGC1hYZUjgHoDcfQx+v5A33V3SCWLpCnuhvuInaE5 Xi0Ip+vsQCYX235hETRSQlvEuEgqAfCbcpwH2e8o2iKMGNWlo9y36K5ChuBxkikyY8y/P+QUtvQ t1KWtoBf+E3d6U6uoRW2FfSgVDPePDVOJhvWJO6QQqiDZvmG5PeVsb/STm1XQyAqG3M0fBYOZMX 97aWctEjDZ1dzzMogVwdzmHFBsCb2TesHyZzzxyntg0Z8MP2p/iJkHAfnS3ei51aY5ueMOu2GUP ShpRu0wWbhsk4Y8AB3Q== X-Authority-Analysis: v=2.4 cv=CdMFJbrl c=1 sm=1 tr=0 ts=69a873f8 cx=c_pps a=vVfyC5vLCtgYJKYeQD43oA==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=EUspDBNiAAAA:8 a=QIdouwm7mKRySFGJXRQA:9 a=QEXdDO2ut3YA:10 a=rl5im9kqc5Lf4LNbBjHf:22 X-Proofpoint-GUID: jCK8jVLd34XrZAlbAwKvKz4KH8W0yCYI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-04_07,2026-03-04_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 adultscore=0 impostorscore=0 bulkscore=0 phishscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603040147 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 Reviewed-by: Bartosz Golaszewski Reviewed-by: Sebastian Reichel --- drivers/power/reset/reboot-mode.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot= -mode.c index fba53f638da04655e756b5f8b7d2d666d1379535..d033043f5250a4de152a7786ef3= 7e88a0ace3bbb 100644 --- a/drivers/power/reset/reboot-mode.c +++ b/drivers/power/reset/reboot-mode.c @@ -3,13 +3,17 @@ * Copyright (c) 2016, Fuzhou Rockchip Electronics Co., Ltd */ =20 +#define pr_fmt(fmt) "reboot-mode: " fmt + #include #include #include #include #include +#include #include #include +#include =20 #define PREFIX "mode-" =20 @@ -74,6 +78,7 @@ int reboot_mode_register(struct reboot_mode_driver *reboo= t) 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,18 @@ 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 (device_property_read_u32(reboot->dev, prop->name, &magic)) { + pr_debug("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->magic =3D magic; info->mode =3D kstrdup_const(prop->name + len, GFP_KERNEL); if (!info->mode) { ret =3D -ENOMEM; @@ -102,8 +106,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 +119,8 @@ int reboot_mode_register(struct reboot_mode_driver *reb= oot) return 0; =20 error: - list_for_each_entry(info, &reboot->head, list) - kfree_const(info->mode); + kfree(info); + reboot_mode_unregister(reboot); =20 return ret; } @@ -130,11 +133,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