Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4278283pxu; Tue, 1 Dec 2020 00:26:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJyi0XV0ptsuUttPPm62Ahmi1n+10eYyIZ1p1m2pUqRpMcF3Yf7UF0x4ElMYqMIPL/7x8LIf X-Received: by 2002:a17:906:5609:: with SMTP id f9mr1819833ejq.535.1606811206320; Tue, 01 Dec 2020 00:26:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606811206; cv=none; d=google.com; s=arc-20160816; b=uY7BpeRDK5mYJtJWKk+R6tcJXnkIVQGoh5GwzhZJ1sQxFQrtRqouk5yiwGnK1bZny7 npQ2W/vDYiZIPj9qJHUiMTtyoey+CicgvBJPldGbPOzrQYvKM0dGRPmYN/m/IzXqDBRg i0jLhL/9HbdWNHzcvj9KRI12jypCuQYRu4VQoJw0+fD5h3pDOEL/sVbluw8rN6A8Kc1/ UF0FMM3GixJWe1x5dvnIb3jtJbnq/GdrnWBOptnueJZsRP7LO9S+Oo878NY/tgadmDUY r4J04ijqbmNK9/HRH7isawXhBwmJ6cMs6FjdvkVpMsKXRLuB+YK7VcaDX8xa3jjzgIG4 m0MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=zdyMsRjcyMGE+EhxcdAL0jrbhc4eClcDF+L96t0SydQ=; b=SqKACr1t7LrzGqtQZniB4Lp/YAKcTInExko8fyfpzmge1Yxf/ueVCqRkwSMTfm/EpV GBN7olc7D5dSu3yyreDk53pl7LmqvF3yQErCn0duqw8ncgrxCLLZ5beHrvVy6E7gomiH SY/EZQXjprIuKo28vtohzjsfQOPVyWyjGr7xMCDfIvqut/tfPiZVJWR7Vgn5mL2jICmu saFuG/7xJhTKIsT8zvS7j/mWd9ZGWKcZvQovC89ZnkTw2kNrt7yKvFY+NMpgCNGdZeSF tqtGpPfC9qgWaa1xBgiiZWRQw4HNfPLeG4I4yOazT+L9J7mHOvjhjysrW3HxRkDOtZvQ rygg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i23si676922edg.60.2020.12.01.00.26.23; Tue, 01 Dec 2020 00:26:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728716AbgLAIYg (ORCPT + 99 others); Tue, 1 Dec 2020 03:24:36 -0500 Received: from mail.v3.sk ([167.172.186.51]:58650 "EHLO shell.v3.sk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726599AbgLAIYg (ORCPT ); Tue, 1 Dec 2020 03:24:36 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 7507FE06F5; Tue, 1 Dec 2020 08:20:59 +0000 (UTC) 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 5p17-b3zC8un; Tue, 1 Dec 2020 08:20:58 +0000 (UTC) Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id CA653DF9A4; Tue, 1 Dec 2020 08:20:58 +0000 (UTC) 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 c0Dpb-dcLFk6; Tue, 1 Dec 2020 08:20:58 +0000 (UTC) Received: from localhost (unknown [109.183.109.54]) by zimbra.v3.sk (Postfix) with ESMTPSA id 986BEE06F5; Tue, 1 Dec 2020 08:20:58 +0000 (UTC) From: Lubomir Rintel To: Liam Girdwood Cc: Mark Brown , linux-kernel@vger.kernel.org, Lubomir Rintel Subject: [PATCH RFC 2/4] Platform: OLPC: Fix handling of regulator registration error Date: Tue, 1 Dec 2020 09:23:46 +0100 Message-Id: <20201201082348.1723631-3-lkundrak@v3.sk> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201201082348.1723631-1-lkundrak@v3.sk> References: <20201201082348.1723631-1-lkundrak@v3.sk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We wouldn't reset ec_priv previously. Let's handle handle the errors in a single spot to fix this. Signed-off-by: Lubomir Rintel --- drivers/platform/olpc/olpc-ec.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/platform/olpc/olpc-ec.c b/drivers/platform/olpc/olpc= -ec.c index faecb73bd8430..2ad638583cc58 100644 --- a/drivers/platform/olpc/olpc-ec.c +++ b/drivers/platform/olpc/olpc-ec.c @@ -427,11 +427,8 @@ static int olpc_ec_probe(struct platform_device *pde= v) =20 /* get the EC revision */ err =3D olpc_ec_cmd(EC_FIRMWARE_REV, NULL, 0, &ec->version, 1); - if (err) { - ec_priv =3D NULL; - kfree(ec); - return err; - } + if (err) + goto error; =20 config.dev =3D pdev->dev.parent; config.driver_data =3D ec; @@ -441,12 +438,16 @@ static int olpc_ec_probe(struct platform_device *pd= ev) if (IS_ERR(ec->dcon_rdev)) { dev_err(&pdev->dev, "failed to register DCON regulator\n"); err =3D PTR_ERR(ec->dcon_rdev); - kfree(ec); - return err; + goto error; } =20 ec->dbgfs_dir =3D olpc_ec_setup_debugfs(); =20 + return 0; + +error: + ec_priv =3D NULL; + kfree(ec); return err; } =20 --=20 2.28.0