Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp592004rdb; Tue, 23 Jan 2024 08:38:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IH3FjDGHfcxnZ57yhkv7j5nbTJ+wiUeqKaxbZ+D+amKWf2bECJnLWi7XAGDmYLj5REVLKDl X-Received: by 2002:ad4:5dc8:0:b0:685:aef6:fb15 with SMTP id m8-20020ad45dc8000000b00685aef6fb15mr1558814qvh.81.1706027923328; Tue, 23 Jan 2024 08:38:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706027923; cv=pass; d=google.com; s=arc-20160816; b=b/ZZQN43jcHbgwpjEQvAWv6m41pls9Daur9z9Vhwugoj5UEjMJgxYnQ982dnhehb6z unXSZN9BLn3tZhvFQTL6w2kgKIQc/Z/xXMbxdIqSxVlh94S7BOAMWAuNW85Hbi2Jfe8A FIFGOlyQ/p0noozBQPgdYfjrxn5dbBB3xzVZUZ7DdFWI2mbsb293mIxShk0eRhsmFhYZ 1dAihzJpFbY/c1Jw6VOzIeSF30QaAGICqqJvDWbtU8UtdSDNkEQA+oyFUT5/zWJvng8E 5Eqt296JoN7yGvz1C1KsgRU18Qn72qdEuaJHgCPN/maQg4b46tg9SeD2yX3C81+0u/J5 8vJQ== 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=zX2Ey45x6SziOonwBIm+VHIBL+95dJLGekCQr6w7tY4=; fh=pozOWq+Llr4uSsAlLarsoaPJ+QQ4TuIyCJyc15dU4WI=; b=ITNodRgKmNFwrA2QjPLOIqY8FrBYszLBo59PZs+fDfP5o+gMeqqQkoZ9/50IiWbb3R 6G5ykvVLWHOAgKLKsL6kO+YSGzvJVgjrqTrWqYOq5UmP5RBN3R/bTn0mWXe70Xu8lVyB HDdeOBFydoFCKFeChjC7gu5tBBX9Td8xUbaAYF66mJ7GkoaERnv5gTyTHPLTuEAQzOWx dRus0gbUIS7p/HKanDusBTYVShnFbQpVYR7oTaXQbR0sd1Fyvlp0CaacBw6mJFJmzXEz EGIiMs7hQNhLBo18fHcioGZKIISBiEWSxdz+uAoQ3LSiX90oetBDy0ixnR7/LwLJmE8f 3afw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="kTnhR/Yx"; 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-35661-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35661-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a13-20020a0ce38d000000b0067abb363a4bsi8350184qvl.231.2024.01.23.08.38.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 08:38:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35661-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="kTnhR/Yx"; 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-35661-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35661-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 19BFB1C2317B for ; Tue, 23 Jan 2024 16:38:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 659BD81211; Tue, 23 Jan 2024 16:37:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="kTnhR/Yx" Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (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 C356D7F7E3; Tue, 23 Jan 2024 16:37:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.141 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706027826; cv=none; b=YOR/yxmMNPuWFvt67P4hI4mBHup90j2a7MhPW9LJUtBMEYlbm/IpGcnISEZ1x9gHNZYoTgUE4LKo4ObLIcIWyxpXyWHopYmsS/9sDk7ooei/HN4GyShQpzOkZtTuiPzTSwFDvHYmuDp2of1Zp/CvKZgH+Y1PCZn9pM+nHU6cnIM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706027826; c=relaxed/simple; bh=j03f6RirHCv9dDLa3rzJLikeTc7jyeColyXtSlKWQhU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VuMd8tR9mdwlMbQHPdTQ7hZfBdK3+MJS17vJH+WbPX9PIx5spX/z2aKFIePaLMvZEG1F7eAWD/RnnY6JG4X1acQ5C0pYnVdLy1CAiZNdF6O1lAgYd8CO5asgjz3IP51ppL8zpNL2GB2smPQfd6RNO+ykoSFL25FukkqmtEVFGw8= 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=kTnhR/Yx; arc=none smtp.client-ip=198.47.19.141 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 lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 40NGavmm077083; Tue, 23 Jan 2024 10:36:57 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1706027817; bh=zX2Ey45x6SziOonwBIm+VHIBL+95dJLGekCQr6w7tY4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=kTnhR/YxtEPDkdBSY2sK+TB9g/rmNtnOnMNsmuKlkoD/6a1mvc9Nsunt9Ewcwxrxk c//FGL7Itlk4b4FxNdmcqaLUXjoLInUh2q0mS+3/3KikuVO9wW0UXBUZT2sJkLPyzT KxS5IsxSl55MXVchDSfr+xaMqAnwCfEF4BA1Qb/w= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 40NGavgq000578 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 23 Jan 2024 10:36:57 -0600 Received: from DFLE100.ent.ti.com (10.64.6.21) 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 DFLE100.ent.ti.com (10.64.6.21) 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:57 -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 40NGarru123403; 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 08/21] power: supply: max77693: Use devm_power_supply_register() helper Date: Tue, 23 Jan 2024 10:36:40 -0600 Message-ID: <20240123163653.384385-9-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/max77693_charger.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/power/supply/max77693_charger.c b/drivers/power/supply/max77693_charger.c index d0157e63b8b50..9ad6cc6500fcc 100644 --- a/drivers/power/supply/max77693_charger.c +++ b/drivers/power/supply/max77693_charger.c @@ -709,9 +709,9 @@ static int max77693_charger_probe(struct platform_device *pdev) goto err; } - chg->charger = power_supply_register(&pdev->dev, - &max77693_charger_desc, - &psy_cfg); + chg->charger = devm_power_supply_register(&pdev->dev, + &max77693_charger_desc, + &psy_cfg); if (IS_ERR(chg->charger)) { dev_err(&pdev->dev, "failed: power supply register\n"); ret = PTR_ERR(chg->charger); @@ -735,8 +735,6 @@ static void max77693_charger_remove(struct platform_device *pdev) device_remove_file(&pdev->dev, &dev_attr_top_off_timer); device_remove_file(&pdev->dev, &dev_attr_top_off_threshold_current); device_remove_file(&pdev->dev, &dev_attr_fast_charge_timer); - - power_supply_unregister(chg->charger); } static const struct platform_device_id max77693_charger_id[] = { -- 2.39.2