Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp618864rdb; Tue, 23 Jan 2024 09:22:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IEB5jLXB5vJQIIJBUXX6Mhd5Dv1ECi/ztYYDORmAYreQanTKbxfFuS//ZvOXAXa0gvRvPna X-Received: by 2002:aa7:da4c:0:b0:55c:3b8e:4372 with SMTP id w12-20020aa7da4c000000b0055c3b8e4372mr1108079eds.64.1706030540830; Tue, 23 Jan 2024 09:22:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706030540; cv=pass; d=google.com; s=arc-20160816; b=rWwoItdegWhUb9qbQIVIe/gvAIF705BHfNbH67+d7Xtais3ZnLcz4JJeUwd6MBu5Dd fn7AWK0Xl9GIfkH2j7xa03+DvZie3JmEAAZYhD5+ZQifKMwMNyKZYPWSOy1yeKfJxaHP jqvDLyEPKXZ8YjmU/7gS03judzSEm3PF6Bdcvaa9osbamCW2pMv/y/7ZoihRvB1+fmd5 o7H3M7QmTTvDk+VMMo4l9jZ1vqPpwbrg+D6Dqpmi4c/dqqhzIt7TR1coTkAX5HQNCVdz kKeadQaaJ7cow+JZgQfFdOnwayGv2b7qFeHRRheDxjQn53NSGNA4Ndp9vqGgHvo+uZSI NPmA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=diBHJatAvryPPmwR5QhjhTLQ3HogCqBjdXM5lGueG/o=; fh=pozOWq+Llr4uSsAlLarsoaPJ+QQ4TuIyCJyc15dU4WI=; b=rq2osnw3ktZoSdInP1ZvlpdjB2GobXDjynaw0CiWOBzHdNw819MR9Mj+9Cs4kaP3PC z1yW2TVaaW9ou94G8xBaa+2FHr9URXJ1Ls/MB9ZGR99pTh8rW9Zrvi3K77rcTLf/v2Rr IeiG3cluEMuPnJWsbN9rSWSiTd4Qb7mUPrdz3IEdjIApDIQVH+YDj9tVdJ0iTt82jh98 5HWxeVeT1yp9jU1+Kj1tydFYxuDIS9uDyJSkwNWbHuVIwvRTX3PEKypB/fdW2VTlVNq0 MDz06n3oyl65UsRT+h+wvMChOOSpabNlG+93ryhiZV59z81NdU9+kJ120nqqFTV2TN0F k9cw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="bMxx/l9h"; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-35676-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35676-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id w22-20020a50d796000000b0055c15d66d35si3026732edi.524.2024.01.23.09.22.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 09:22:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35676-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="bMxx/l9h"; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-35676-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35676-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3152E1F2C89D for ; Tue, 23 Jan 2024 16:41:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 85A0986AEA; Tue, 23 Jan 2024 16:37:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="bMxx/l9h" Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) (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 1B7098003F; Tue, 23 Jan 2024 16:37:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.142 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706027830; cv=none; b=X3ie5sEUw0Z9p5iSS7IdHaTbwVKH+Ziv0k6+HGCjJ5PMvhsoZE4lw1RXFN2w6gHaxRag4MO5R0zwNv+WA0xxFfb4aaWzpzl/DZkmTHN5gzmBmS5Ep0QrR5MWoKSqSxcj16G5KD6f+g+oOO93Qf2JWQifxPmVaYa5fzK7FxBtZ28= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706027830; c=relaxed/simple; bh=fV62+saH4kX+KvcUIgx0K7XduczaJo6RzCgbuK4WLWk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=arRsPk5NFx3v9Ar8m4+yX2+nQPZSlEWCwe2gO1oqEP+nLMAR/f57U5yx+uNabQ5i4D+e24sEJjw0M0aOK02z+ITq8ePbVfZzhdlLVblAIsOiSeAVihCid8EzuGzNs+uj2GfYZIw15KyQTMKRxkIsXxAzlBT2nt4a12+FaFLBnEI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=bMxx/l9h; arc=none smtp.client-ip=198.47.19.142 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 40NGauRb094124; Tue, 23 Jan 2024 10:36:56 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1706027816; bh=diBHJatAvryPPmwR5QhjhTLQ3HogCqBjdXM5lGueG/o=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=bMxx/l9hM5use8S9QIMjbiMf0d4kn0de/4/auLbNSawJyuF9/DhOzkRujnR/AK8UL DjsX7e9lQ+cIiM79/Mk7Rv64eSJrnDZgpnp+PthZoJndHReqMQHAxRmBsXmKMkHLoy 6jrtdGW98u/BrQB79ce3so2TtLt4+/uDdquZT9wM= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 40NGau6s033972 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 23 Jan 2024 10:36:56 -0600 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 23 Jan 2024 10:36:56 -0600 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Tue, 23 Jan 2024 10:36:56 -0600 Received: from lelvsmtp6.itg.ti.com ([10.249.42.149]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 40NGarrt123403; Tue, 23 Jan 2024 10:36:56 -0600 From: Andrew Davis To: Sebastian Reichel , Support Opensource , Krzysztof Kozlowski , =?UTF-8?q?Pali=20Roh=C3=A1r?= CC: , , Andrew Davis Subject: [PATCH 07/21] power: supply: max14577: Use devm_power_supply_register() helper Date: Tue, 23 Jan 2024 10:36:39 -0600 Message-ID: <20240123163653.384385-8-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240123163653.384385-1-afd@ti.com> References: <20240123163653.384385-1-afd@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Use the device lifecycle managed register function. This helps prevent mistakes like unregistering out of order in cleanup functions and forgetting to unregister on error paths. Signed-off-by: Andrew Davis --- drivers/power/supply/max14577_charger.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/power/supply/max14577_charger.c b/drivers/power/supply/max14577_charger.c index 7c23fa89ea199..1fff82b037097 100644 --- a/drivers/power/supply/max14577_charger.c +++ b/drivers/power/supply/max14577_charger.c @@ -586,8 +586,9 @@ static int max14577_charger_probe(struct platform_device *pdev) } psy_cfg.drv_data = chg; - chg->charger = power_supply_register(&pdev->dev, &max14577_charger_desc, - &psy_cfg); + chg->charger = devm_power_supply_register(&pdev->dev, + &max14577_charger_desc, + &psy_cfg); if (IS_ERR(chg->charger)) { dev_err(&pdev->dev, "failed: power supply register\n"); ret = PTR_ERR(chg->charger); @@ -611,7 +612,6 @@ static void max14577_charger_remove(struct platform_device *pdev) struct max14577_charger *chg = platform_get_drvdata(pdev); device_remove_file(&pdev->dev, &dev_attr_fast_charge_timer); - power_supply_unregister(chg->charger); } static const struct platform_device_id max14577_charger_id[] = { -- 2.39.2