From nobody Sat Feb 7 15:05:57 2026 Received: from AM0PR02CU008.outbound.protection.outlook.com (mail-westeuropeazon11013034.outbound.protection.outlook.com [52.101.72.34]) (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 CFBA6318BBF; Fri, 23 Jan 2026 08:55:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.72.34 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769158550; cv=fail; b=mkw4Fq7hwHseWvyIRM9VkkJBAt50VCai2lI190/snN9DaQgW6SfU6F8MWWLy+CRrqzG6JuX/iLP0I3A+ZALUQFzFgc6k8dDTxjRCe+vIc5GzaH5FpBvIOahxRHmVmnCJ2mzFL3HDkpxQagMaPhAEfuekJL+ut30M8tQwJo6zhWU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769158550; c=relaxed/simple; bh=uFmMUsCDe0lD+DK0TfE+JoYw6JwYqsnwSqZgDvzaaGw=; h=From:To:CC:Subject:In-Reply-To:References:Message-ID:Date: MIME-Version:Content-Type; b=AarZkp7/IEpSqI0rn7QrLNr6D78p3HnL+b13+AwaOWznDW5CFTMSJoKpd0z0haxEbJ6G/PlJ3mzBnmTjf9zweo9+du+OzIhWE2ELIlrR/n3W7O2NiWFeB0sMUIcCA4ARFU4fGoE12RpBiM76R/QKviKwwjSrT33wvvjDLii5WLA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=axis.com; spf=pass smtp.mailfrom=axis.com; dkim=pass (1024-bit key) header.d=axis.com header.i=@axis.com header.b=S6d7KjuI; arc=fail smtp.client-ip=52.101.72.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=axis.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=axis.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=axis.com header.i=@axis.com header.b="S6d7KjuI" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lcKsc5FCLAjUytOwEtzxKF8FOUE6m8vx1SQRZI3XUxNSn8B4iHV7m60kGTWVXFfIEw9f665Oy/WTS5zjXc+Du1mKdavoABtasxG4aHt2cNphLZg6AiM1CEJ6rdvvmtlcglnJXbUMDVSyWqgf+MfJoGAMP56TdOLTscasH/IRdqqXd+7g4/P6EcxFh+YuCWuHsmQqHzI8fugNJPTzuxCtHfDcmeEWUIzAcXvzTAl0sEzZbgLa4TVSuDuH0mzG5r90Xgu44Y+r99xov693GG+U3kzT7/4uhJSgw+/T8zJXxhuNH1BFmSo1EZDxdmKIAFYsx7jejK/5NSsjDhsuEd1MjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=khRa5WMZOr5twJvYoO4a+WRzoxzReeg+eaapXqLXQpw=; b=JO3KiP5wphohFOzpjGqftC4axnlYz1t3abET9O4sm6M1w0ss7fGgaR+8+LRMinMhhKyTEI22VqiXcscbr/k2aCR9l7x1coesbMjHly8M2NfNCHuTGXSpbCfy+BPLuspNjNe5zdFth24yk2TaoQe3qYDnDA80njtKyCA+wsZEjpfFjaH/e8vMm57VKQwLWTA2lsr+gYx9MUYSaOR0hjR9/bCg3Mo1edE6tmy4VRkXRZxq/reMmX9K8uI3JmwoUg2xRMHdbHM+TnzCA0qUq7lVsILoMex/2kN1zJbxu2yLwCTe1g9JGqh4Q4HwkhxGtHkN6ht2D/MPvVhaiy3Q/FVrwg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=axis.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=khRa5WMZOr5twJvYoO4a+WRzoxzReeg+eaapXqLXQpw=; b=S6d7KjuIaFNl0vkK7NjtTyOCHRJCxQVvW5RlsLsWQ+8gj6HTReuiNZJfzIIvCOJvN14mKJ7hwh5Ejcd3C8e88sFd8Nj5cSgA0XYnCIW3Y2KLQUhe4HYoBUn3n0D7JoKABAA2POETowNYB7hDMEPTS0eVfkAxHmgNcBtQazTp+oA= Received: from DU7PR01CA0016.eurprd01.prod.exchangelabs.com (2603:10a6:10:50f::11) by AS2PR02MB9261.eurprd02.prod.outlook.com (2603:10a6:20b:5fd::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9542.11; Fri, 23 Jan 2026 08:55:44 +0000 Received: from DB1PEPF000509F7.eurprd02.prod.outlook.com (2603:10a6:10:50f:cafe::e3) by DU7PR01CA0016.outlook.office365.com (2603:10a6:10:50f::11) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9542.12 via Frontend Transport; Fri, 23 Jan 2026 08:55:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=axis.com; Received-SPF: Pass (protection.outlook.com: domain of axis.com designates 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; pr=C Received: from mail.axis.com (195.60.68.100) by DB1PEPF000509F7.mail.protection.outlook.com (10.167.242.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9564.3 via Frontend Transport; Fri, 23 Jan 2026 08:55:44 +0000 Received: from pc52311-2249 (10.4.0.13) by se-mail10w.axis.com (10.20.40.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1748.39; Fri, 23 Jan 2026 09:55:43 +0100 From: Waqar Hameed To: Sebastian Reichel CC: , , Subject: [PATCH v2 1/2] power: supply: wm97xx: Use devm_kcalloc() In-Reply-To: References: User-Agent: a.out Message-ID: <5ac93f5b0fa417bb5d9e93b9302a18f2c04d4077.1769158280.git.waqar.hameed@axis.com> Date: Fri, 23 Jan 2026 09:55:43 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: se-mail02w.axis.com (10.20.40.8) To se-mail10w.axis.com (10.20.40.10) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF000509F7:EE_|AS2PR02MB9261:EE_ X-MS-Office365-Filtering-Correlation-Id: 3b63a30f-ec01-4bd3-dbbf-08de5a5d31be X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?m5T1sg10c9pqQ7N/VyeRDl0z4NvFvJF8Av+oCEmYs/JZApKKaKiv2VJx99St?= =?us-ascii?Q?/Y21OphPDdzjR9LhOS3BHjZFjcSUUkrb8DlUfuNSIcmMrOKFM8fa7M0oLWgw?= =?us-ascii?Q?RtkVczWmCTD8KeovPLpUfsZP1fqqoPNajmeTWu2Ps06S2emNO6FFbUA4BBdP?= =?us-ascii?Q?XJFON0nZrcmvHjm2e+QtmnJowfdTsb5WYFdMAwjBlAmDKotP5jcQTQQsRsAS?= =?us-ascii?Q?B8ppewcqwcfX02PQ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muWhOw?= =?us-ascii?Q?lwyx8PXh6kSQf/p9whBo/mDCwb6SZlbIigkwP501c3gDH6UAD04iArLXHZQs?= =?us-ascii?Q?ISbpAua7EFFvUCAdbRQFBV2gKNIynXM1OUMXAaimynDTcGaJkhl5H3OOqG6o?= =?us-ascii?Q?ab9YukFrq+WXME0sADWuOYtyZVVS8Gu9chMGvH1YZyCc5D2UTb9hI3wlCGfo?= =?us-ascii?Q?H+4RU0f/0Gb+obyLhUSzWunCI4NuXxhFwhWGkulqYWhUodi8MKYM41Nl5a+V?= =?us-ascii?Q?bFQnvGpd5sK7fvvmKiVNxnTR6KKq4yIEc9X2jrf+3nlclpabqkJ2WWpm5L+7?= =?us-ascii?Q?tLoQQmna/Afpj2Itj1a2J1As4qSDZgvC+du0uBHCHp78bb/vVgf4y8QsQPmL?= =?us-ascii?Q?McP+CAjrA1LKh2l8cdRxoW2cB3CiGo2hOjA/aoeGcPS7WWZHTKO421QiGrYa?= =?us-ascii?Q?VV6XF6Apx1rixPhU/PYLpvjpsTRjw6sWc3RlgDK7rtYVjTdqNgflfmVrAIf3?= =?us-ascii?Q?eMsEBypIUFiHzPRonZSR3cUa8hN7rsDk/tiHCkIAOJTlGvm2vPvpjJci90Kk?= =?us-ascii?Q?EFjgKw=3D=3D?= X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(36860700013)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2026 08:55:44.5752 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3b63a30f-ec01-4bd3-dbbf-08de5a5d31be X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF000509F7.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR02MB9261 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of handling the memory allocation manually, use the automatic `devres` variant `devm_kcalloc()`. This is less error prone and eliminates the `goto`-path. Signed-off-by: Waqar Hameed --- drivers/power/supply/wm97xx_battery.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/power/supply/wm97xx_battery.c b/drivers/power/supply/w= m97xx_battery.c index f00722c88c6fe..c30c347b48f99 100644 --- a/drivers/power/supply/wm97xx_battery.c +++ b/drivers/power/supply/wm97xx_battery.c @@ -192,7 +192,7 @@ static int wm97xx_bat_probe(struct platform_device *dev) if (pdata->min_voltage >=3D 0) props++; /* POWER_SUPPLY_PROP_VOLTAGE_MIN */ =20 - prop =3D kcalloc(props, sizeof(*prop), GFP_KERNEL); + prop =3D devm_kcalloc(&dev->dev, props, sizeof(*prop), GFP_KERNEL); if (!prop) return -ENOMEM; =20 @@ -224,12 +224,10 @@ static int wm97xx_bat_probe(struct platform_device *d= ev) bat_psy_desc.num_properties =3D props; =20 bat_psy =3D power_supply_register(&dev->dev, &bat_psy_desc, &cfg); - if (!IS_ERR(bat_psy)) { - schedule_work(&bat_work); - } else { - ret =3D PTR_ERR(bat_psy); - goto free; - } + if (IS_ERR(bat_psy)) + return PTR_ERR(bat_psy); + + schedule_work(&bat_work); =20 if (charge_gpiod) { ret =3D request_irq(gpiod_to_irq(charge_gpiod), wm97xx_chrg_irq, @@ -246,9 +244,6 @@ static int wm97xx_bat_probe(struct platform_device *dev) unregister: power_supply_unregister(bat_psy); =20 -free: - kfree(prop); - return ret; } =20 @@ -258,7 +253,6 @@ static void wm97xx_bat_remove(struct platform_device *d= ev) free_irq(gpiod_to_irq(charge_gpiod), dev); cancel_work_sync(&bat_work); power_supply_unregister(bat_psy); - kfree(prop); } =20 static struct platform_driver wm97xx_bat_driver =3D { --=20 2.39.5 From nobody Sat Feb 7 15:05:57 2026 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11011000.outbound.protection.outlook.com [52.101.65.0]) (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 3CA9C3242CE; Fri, 23 Jan 2026 08:55:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.0 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769158550; cv=fail; b=lwRSqAPf4Vi3/chPnpFhnnrfyE1AOR8gREqIul35Plj4yJPF+sI/bCKBbXWXi9eOgW3vOgHqtoew3L6Ky+Ez3X7dX4GVc84D7E3bcFs0ueY05fh4/GQXF7oO/NcvzVBpmejisNXQRPO3EiybsRuI5Od1Wi4OzBeR8LE1XaOIlfQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769158550; c=relaxed/simple; bh=LUiLiDbi5DE+ztV80oTkBrxzUN65ZdBQK4qEirH0Te4=; h=From:To:CC:Subject:In-Reply-To:References:Message-ID:Date: MIME-Version:Content-Type; b=VTBwTeQ7t26MEvOFtSOEQ/3TwtAZmZ8OVX2tB1mDt3NkvRWB7r1dtehIsHSO4HJDLqVTF5DAI9PfqH1Cot/3Qym2i3JxmeBc5htPVa+v+tUOXIXE8APxDhdVjJY6rDGwWnsp8ffLzlM5AJRTdUGLLNoLhmWkBFSHsqVwygAHt1A= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=axis.com; spf=pass smtp.mailfrom=axis.com; dkim=pass (1024-bit key) header.d=axis.com header.i=@axis.com header.b=j/288ZdW; arc=fail smtp.client-ip=52.101.65.0 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=axis.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=axis.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=axis.com header.i=@axis.com header.b="j/288ZdW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YhvhMKJqcaR+CAinWHrTgFVlPfcHGtVrBsF3JfpNFzpoXAPDJ8KnbTjgCdngAey0tY9DLc68l9RdOVW+HyP2k288eyO6gQIrZNjptlvHdNqONpEwQ3iZtMQcyAVyjUn9HPbyLZwmeLsMOLoX3tMCK0oJYEVT1X4aEVfL+yHgplBk7Px90JGgsuwr69EuT/uE4fcOCzoA5hTcVc+JrwKSh4sXd9/FiQbZbCEZG9+ILVp1HO2/8KaJ3Ssnn+tiAFNg/FAqorelsaXw5niU4iK71AzFi0BRbDkHbHvXJ6MhzQbOJylblt8Fqf3Zp1qYq3p+bydBzeWSmoqropW6ArSiAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0ltHu0nNmVrn/la/oLgSFfRyOU8aT+BqSYxtYirJMyE=; b=lwB25VucM3IQSaJCM71s3o3s2edgCnRZz+ZAMYJvtVcqHZDKjwRyu/wnl0gB0GpDldqaK2JvI64DmFiJPw1Y+LS/AD0JxjK2xonARpJsbtOtElULnCoxyx/T/Ks75DXsUmZNM9NuR0A0XLARUAfM5yWVZmyxP3r5wNI6mz+VL2I3xtNFsoxQ2x3evux8V71fiXmB33Mzn6YbfDBhr5ElpI6JmV8z5Kp9ECWhFyTHjub8ekF8vlHDozAZ2t9/HDv8lrUQv25cwqffa4vgwmPip796BpR3TpQyEaNIehgqPrAO54d5GYwK2LDS1rX4pkNKw/+dls6NJIAqVxZx7SLrzQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=axis.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0ltHu0nNmVrn/la/oLgSFfRyOU8aT+BqSYxtYirJMyE=; b=j/288ZdWDSIVRGk10rtcz8D9r5z6/7NFkKsxuGpnziNgcDGl9L1TmcFkpLd7ds+PGMRLX/qLq4CqnHWLcPs1iFM1GzixMy1aWmxyvEynBgKiYDmiGx/8+Eq8qvXKEG53m+oFhi07gAxWSumePL+YA9R37uhAIJFmJM15ahqgYtE= Received: from DU7PR01CA0006.eurprd01.prod.exchangelabs.com (2603:10a6:10:50f::6) by AM7PR02MB5829.eurprd02.prod.outlook.com (2603:10a6:20b:10f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9542.11; Fri, 23 Jan 2026 08:55:45 +0000 Received: from DB1PEPF000509F7.eurprd02.prod.outlook.com (2603:10a6:10:50f:cafe::1e) by DU7PR01CA0006.outlook.office365.com (2603:10a6:10:50f::6) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9542.12 via Frontend Transport; Fri, 23 Jan 2026 08:56:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=axis.com; Received-SPF: Pass (protection.outlook.com: domain of axis.com designates 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; pr=C Received: from mail.axis.com (195.60.68.100) by DB1PEPF000509F7.mail.protection.outlook.com (10.167.242.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9564.3 via Frontend Transport; Fri, 23 Jan 2026 08:55:45 +0000 Received: from pc52311-2249 (10.4.0.13) by se-mail10w.axis.com (10.20.40.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1748.39; Fri, 23 Jan 2026 09:55:43 +0100 From: Waqar Hameed To: Sebastian Reichel CC: , , Subject: [PATCH v2 2/2] power: supply: wm97xx: Use devm_power_supply_register() In-Reply-To: References: User-Agent: a.out Message-ID: Date: Fri, 23 Jan 2026 09:55:43 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: se-mail01w.axis.com (10.20.40.7) To se-mail10w.axis.com (10.20.40.10) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF000509F7:EE_|AM7PR02MB5829:EE_ X-MS-Office365-Filtering-Correlation-Id: f2f8f7fc-24ab-4bf5-adc6-08de5a5d323d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?uEMm67G0SsQhGwQcDwA/4+wwXasFGS+oLcwD3HHbbHaKlyjN7GNdM5e2l1cV?= =?us-ascii?Q?0Kry3hv+OyutlAG2txf6Yz6FabVRbK3mBXKV4pBGYoyn325dZJ9xrDcKpYWf?= =?us-ascii?Q?qczaPvqKELZX+/xw5TSLxkIs8GkWQYxvnu2AaNJbphaVE7UCTbQdaPnNn/50?= =?us-ascii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ybg4K/aeCg?= =?us-ascii?Q?zIrDoU6hiWD3afdE1hi1YhBI5T89jME13sYtMr2IZjKGFqFMHCVBswuspmch?= =?us-ascii?Q?eZiZy6JWM6ptYRhDp9W6edCUuHPi52HTgOqGgGmmbnrz2WNTuiEKhout03qo?= =?us-ascii?Q?xjrrJezIR1sqBti6dqlwE5aSPDzLiIK49NR0PexuWEuW5ObX/OoFMONynMe3?= =?us-ascii?Q?vJfBpjpiDmaUiCxyhpYfl2ikw4V//prWkuCGoZS5F6fas18cKYEcC6n7L1ae?= =?us-ascii?Q?XsuPJ98FNgV5jLnwbxD72LABuOa9X6IMiGi6U64pR++agRR1f9mUPDWV3+Fz?= =?us-ascii?Q?o6dCe/coTPlZXLf/ZL7pRAJzIG3JMjmKPCOo67w0geMRky2ENBzU+jIoWtB5?= =?us-ascii?Q?MOYM+rCLT0xMdrW5Y9MGvh/JQHrQsMm3aDjynZJrKDxkZ6pS7YiPTChkIzIG?= =?us-ascii?Q?V/dYPiVkVeHZ9m69CkUMoeKXiKd2a1YUkJEU8XE4CDxqYMRKQ6CT6UvKbWqS?= =?us-ascii?Q?30O13U2kZf3Eh6c+EJOjW5YptrdBJeQA2VCirMdm06WwklktvHrrJxXQ41Xw?= =?us-ascii?Q?DWGZP7ssEOIsSKApikOrhOJ6XtKlKW2706H1B9C3lV8zWvZxyxs0esdxkPgS?= =?us-ascii?Q?bv6oOw=3D=3D?= X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(376014)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2026 08:55:45.4055 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f2f8f7fc-24ab-4bf5-adc6-08de5a5d323d X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF000509F7.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR02MB5829 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of handling the registration manually, use the automatic `devres` variant `devm_power_supply_register()`. This is less error prone and cleaner. Signed-off-by: Waqar Hameed --- drivers/power/supply/wm97xx_battery.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/power/supply/wm97xx_battery.c b/drivers/power/supply/w= m97xx_battery.c index c30c347b48f99..a6c55b1e02863 100644 --- a/drivers/power/supply/wm97xx_battery.c +++ b/drivers/power/supply/wm97xx_battery.c @@ -223,7 +223,7 @@ static int wm97xx_bat_probe(struct platform_device *dev) bat_psy_desc.properties =3D prop; bat_psy_desc.num_properties =3D props; =20 - bat_psy =3D power_supply_register(&dev->dev, &bat_psy_desc, &cfg); + bat_psy =3D devm_power_supply_register(&dev->dev, &bat_psy_desc, &cfg); if (IS_ERR(bat_psy)) return PTR_ERR(bat_psy); =20 @@ -232,19 +232,12 @@ static int wm97xx_bat_probe(struct platform_device *d= ev) if (charge_gpiod) { ret =3D request_irq(gpiod_to_irq(charge_gpiod), wm97xx_chrg_irq, 0, "AC Detect", dev); - if (ret) { - dev_err_probe(&dev->dev, ret, - "failed to request GPIO irq\n"); - goto unregister; - } + if (ret) + return dev_err_probe(&dev->dev, ret, + "failed to request GPIO irq\n"); } =20 return 0; - -unregister: - power_supply_unregister(bat_psy); - - return ret; } =20 static void wm97xx_bat_remove(struct platform_device *dev) @@ -252,7 +245,6 @@ static void wm97xx_bat_remove(struct platform_device *d= ev) if (charge_gpiod) free_irq(gpiod_to_irq(charge_gpiod), dev); cancel_work_sync(&bat_work); - power_supply_unregister(bat_psy); } =20 static struct platform_driver wm97xx_bat_driver =3D { --=20 2.39.5