Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3517413pxf; Mon, 15 Mar 2021 11:18:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/jGNb/eiEBDJaXHyhTopl45w2h1LJs0gQDXt16lfJFQbaoitkrkwUKGy38++ymjKGSISH X-Received: by 2002:a17:906:1182:: with SMTP id n2mr25575753eja.234.1615832287919; Mon, 15 Mar 2021 11:18:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832287; cv=none; d=google.com; s=arc-20160816; b=hIa7rFzhF8re6rEhn2T4tf10ihRXHrD8wtJE5LfBi5D4S+xfRLkVMGnxq6hVJK68k4 cJ6J/ajawdGDOrbggNeqMXnVMGbF785aXhRlHILIARla+ApEaZs8cyZXxpWU3UlzYceW TBYoi6DKhJAu8xo582WXqlSVMVYgnVEgkS76URT8zuIHKslvJM51SfhLYNgP3WbxUES7 XLpNPDECrTwMazW5plKcJYpsefThrkR01S12lWHRUBfQS4Eg+ONE9zqyqKcY4tvD84ap PMvZYgsvZ8WkbZllOcbVXyCe4gQnNOUwYv2qEB4hFMZtzgk6xWsfWfEBGFFJ7VACJsib TUow== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=D36AcO2wr4fOJFcp0tyyShD8abj+qEEf5SLS6gMkK3U=; b=w7ixS9t5VEhtGW/rpnh9plhb3DdXxRPCTE6rXgTyj9rlQEiIdqMBdWFMdhrEkGsZCL u9SELtFBzgjHEohmW7yA7dQOiN+Ml2I8zs9ZU32vT1t2IvceQngOuiCMptlrWsSDtPW3 0GJZEU9kM+7KBbcuGqpaobioRGHm4YdqGOyXcBacO/Ln41qRAfEQrrbkU247FGypUJY9 Igt7KizmCyOUVUa4RKjIhlNL7hn8nn9mEh1EknMgAwwznM2dc3hvuZV6z6Wv9eUtjXcp gUHogsGsT0oZ4+8gXblSCe1mA0FhRP8h36uMQpml/hIBekDQ18rvZXBmExeDglVXTLKt 5Rnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PJuZS32N; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b11si11942164edz.197.2021.03.15.11.17.46; Mon, 15 Mar 2021 11:18:07 -0700 (PDT) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PJuZS32N; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236801AbhCOOP3 (ORCPT + 99 others); Mon, 15 Mar 2021 10:15:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:37476 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232488AbhCON66 (ORCPT ); Mon, 15 Mar 2021 09:58:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3C23664F70; Mon, 15 Mar 2021 13:58:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816721; bh=1LANfikIH4WX96lOTe4tjEdD+qWcOW6ze56Lfeyz/Dc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PJuZS32NkkDLva9oBkTbDXvlbGOXNRLKC4qXoO+HhCzbeI+Mu3Mpw1psnE9f3CLyX LyeXQlrR5R+d3MSKujc/fFzVVN41Pp+76GC0u+WqwPVVPqmNWmf+TXcfgV1U/jSyLo kk/9jMGE6ij2oeIiWAteD+Mr85BBLOE3k5WXOjws= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lubomir Rintel , Hans de Goede , Sasha Levin Subject: [PATCH 5.4 067/168] Platform: OLPC: Fix probe error handling Date: Mon, 15 Mar 2021 14:54:59 +0100 Message-Id: <20210315135552.570557462@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135550.333963635@linuxfoundation.org> References: <20210315135550.333963635@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Lubomir Rintel [ Upstream commit cec551ea0d41c679ed11d758e1a386e20285b29d ] Reset ec_priv if probe ends unsuccessfully. Signed-off-by: Lubomir Rintel Link: https://lore.kernel.org/r/20210126073740.10232-2-lkundrak@v3.sk Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin --- 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 f64b82824db2..2db7113383fd 100644 --- a/drivers/platform/olpc/olpc-ec.c +++ b/drivers/platform/olpc/olpc-ec.c @@ -426,11 +426,8 @@ static int olpc_ec_probe(struct platform_device *pdev) /* get the EC revision */ err = olpc_ec_cmd(EC_FIRMWARE_REV, NULL, 0, &ec->version, 1); - if (err) { - ec_priv = NULL; - kfree(ec); - return err; - } + if (err) + goto error; config.dev = pdev->dev.parent; config.driver_data = ec; @@ -440,12 +437,16 @@ static int olpc_ec_probe(struct platform_device *pdev) if (IS_ERR(ec->dcon_rdev)) { dev_err(&pdev->dev, "failed to register DCON regulator\n"); err = PTR_ERR(ec->dcon_rdev); - kfree(ec); - return err; + goto error; } ec->dbgfs_dir = olpc_ec_setup_debugfs(); + return 0; + +error: + ec_priv = NULL; + kfree(ec); return err; } -- 2.30.1