Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp414258imc; Sun, 10 Mar 2019 09:25:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqwReHIhOWxCzHzGOXotm29JpZkrpcL6JsFh2Eqm2jRcerETTOmLPLQBCLt3+sBM1tGIzIno X-Received: by 2002:a63:6b45:: with SMTP id g66mr26674966pgc.301.1552235144311; Sun, 10 Mar 2019 09:25:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552235144; cv=none; d=google.com; s=arc-20160816; b=LHrqrmhqroxXNpiefVV/DwtohAMezHitWwLEX6zu+18NBCHuLY0MfH5Z+nQ2BaBKSN w4tCOCakbDi06jeUWXOgd+pknygk3xDwjsTYK79jsVHHzq4gwsaE4JN0c7KqD9F+TyjU MtCF4wCVmijdrWcdL0svCWuGfylVLVLzlE0nNRgP+lVMtoLz5PYKFsOibGPBrccEqJT/ o8kUEphqBKA71PPJ8fcykP6SFJBeK+LEuDny0Umk4G7AUCGX3+NI0LU8uH+OkG/hyr9u lQE3XMKeo5r3lZD2yCjT6rDBs1CdhxMmL1c89nm+w+aJKojuhvQOs6L8zcsM2xvQFdKF rZBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=AQg7tVANCescbTo1nwT2tIyS7xEYEIEd5oa3wcQ/LGU=; b=BwyrlmMKYAJt1eskkcYveD03QkfCFCfO8ZF/Zp8QhsuncWycW//sd8ThgdSgqaxAel dWTYpe0GsOtCNr9YdbI86+C2LX2noNe/BLKN7BI8/A/NpgWRv7whiXEM0d4aGZ5CJhCX 4PW5TsptJLHfJ45UBZQnOfeQinUNuI38n5NGD72INOd5vpLU3mJAhiGPrDvEPssIDahI n37hnL+M1iF/KTLDoK+NnC5eHU/9P58GUH0p4CrY4ZVpAU1BW+uG3wGVYCEt24kBRdCq pW+ADRq6XGgWA+BKCfwEo/kt9cDjly5VBYWincJReZj8XCBgfpX973gDIcn5+fK3ENuR fvRA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q19si2934371pgi.554.2019.03.10.09.25.28; Sun, 10 Mar 2019 09:25:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726719AbfCJQY4 (ORCPT + 99 others); Sun, 10 Mar 2019 12:24:56 -0400 Received: from shell.v3.sk ([90.176.6.54]:45123 "EHLO shell.v3.sk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726639AbfCJQYx (ORCPT ); Sun, 10 Mar 2019 12:24:53 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 7947E102CBF; Sun, 10 Mar 2019 17:24:50 +0100 (CET) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id Ymp_WlQIAJv8; Sun, 10 Mar 2019 17:24:37 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id D5037102CAD; Sun, 10 Mar 2019 17:24:33 +0100 (CET) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 9I9fASWIcxMm; Sun, 10 Mar 2019 17:24:31 +0100 (CET) Received: from nedofet.lan (ip-89-102-31-34.net.upcbroadband.cz [89.102.31.34]) by zimbra.v3.sk (Postfix) with ESMTPSA id A9B85102CB4; Sun, 10 Mar 2019 17:24:30 +0100 (CET) From: Lubomir Rintel To: Sebastian Reichel Cc: Darren Hart , Rob Herring , Mark Rutland , x86@kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Lubomir Rintel , Sebastian Reichel Subject: [PATCH 07/10] power: supply: olpc_battery: Use devm_power_supply_register() Date: Sun, 10 Mar 2019 17:24:16 +0100 Message-Id: <20190310162419.11861-8-lkundrak@v3.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190310162419.11861-1-lkundrak@v3.sk> References: <20190310162419.11861-1-lkundrak@v3.sk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This simplifies the error handling. Signed-off-by: Lubomir Rintel Reviewed-by: Sebastian Reichel --- Changes since v1: - This was split off the "power: supply: olpc_battery: Move priv data to a struct" patch. drivers/power/supply/olpc_battery.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/power/supply/olpc_battery.c b/drivers/power/supply/o= lpc_battery.c index f7bb9bedd893..d83c77c2a0ec 100644 --- a/drivers/power/supply/olpc_battery.c +++ b/drivers/power/supply/olpc_battery.c @@ -634,7 +634,7 @@ static int olpc_battery_probe(struct platform_device = *pdev) psy_cfg.of_node =3D pdev->dev.of_node; psy_cfg.drv_data =3D data; =20 - data->olpc_ac =3D power_supply_register(&pdev->dev, &olpc_ac_desc, &psy= _cfg); + data->olpc_ac =3D devm_power_supply_register(&pdev->dev, &olpc_ac_desc,= &psy_cfg); if (IS_ERR(data->olpc_ac)) return PTR_ERR(data->olpc_ac); =20 @@ -648,15 +648,13 @@ static int olpc_battery_probe(struct platform_devic= e *pdev) olpc_bat_desc.num_properties =3D ARRAY_SIZE(olpc_xo1_bat_props); } =20 - data->olpc_bat =3D power_supply_register(&pdev->dev, &olpc_bat_desc, &p= sy_cfg); - if (IS_ERR(data->olpc_bat)) { - ret =3D PTR_ERR(data->olpc_bat); - goto battery_failed; - } + data->olpc_bat =3D devm_power_supply_register(&pdev->dev, &olpc_bat_des= c, &psy_cfg); + if (IS_ERR(data->olpc_bat)) + return PTR_ERR(data->olpc_bat); =20 ret =3D device_create_bin_file(&data->olpc_bat->dev, &olpc_bat_eeprom); if (ret) - goto eeprom_failed; + return ret; =20 ret =3D device_create_file(&data->olpc_bat->dev, &olpc_bat_error); if (ret) @@ -671,10 +669,6 @@ static int olpc_battery_probe(struct platform_device= *pdev) =20 error_failed: device_remove_bin_file(&data->olpc_bat->dev, &olpc_bat_eeprom); -eeprom_failed: - power_supply_unregister(data->olpc_bat); -battery_failed: - power_supply_unregister(data->olpc_ac); return ret; } =20 @@ -684,9 +678,6 @@ static int olpc_battery_remove(struct platform_device= *pdev) =20 device_remove_file(&data->olpc_bat->dev, &olpc_bat_error); device_remove_bin_file(&data->olpc_bat->dev, &olpc_bat_eeprom); - power_supply_unregister(data->olpc_bat); - power_supply_unregister(data->olpc_ac); - return 0; } =20 --=20 2.20.1