Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3524036pxf; Mon, 15 Mar 2021 11:28:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz57fZP3nrxmCY/N+FvEUjBQmWjRyL5ppc/P1QbsMUC/pggl0oqO/iMW8lU0b5Elj4RzJaZ X-Received: by 2002:a17:906:6bd1:: with SMTP id t17mr25447457ejs.319.1615832888356; Mon, 15 Mar 2021 11:28:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832888; cv=none; d=google.com; s=arc-20160816; b=UX3T7vvxxprHkJmUDQqTMrIjyT/HR9rdAqoQ9eC5dyaDlm8n8YM+T+FRaECIncZdKw 5Zy85QpCNfAhDeyjU1hLcR62J85kcg3K52LmRoKhFO3dNYizcCLrSe5jdi7NyZ4LoZme PTsXaW3koBQklqWQsVRt84b8y3Lhl72TeN9TOZScHt4bK1WIBA6rCyOilHv22DHfWWtJ IhkflON40GHirIg6WLbnvgqywaHax4w77s9iTKfaiWPxYoM/XzXdAa9CNDQ/1kzZMu09 5sbRGuYWk7ZQcPi/XsNhw8BVzBCy+ImdFV/br1AlpXeP+iBMLJ6NYe2LV9+VpGhwE3IP /2+g== 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=QgQOV6jCtbrdOPFraHM0o+NbqiPHvsY7oglB+q6qadZ1IQ7QNRlIxfmJ7cRIyKHF/r mGgefgT+oQa4/4REKK/ODeeZQTXgdS4CgTORlNTDN1WzPG/nu+BCTCVFOJySiI2b2IkI gVP73VyZRn+O6s4vAg652GpsgqJyz/tIvZC9BNIUPe+rwDoVaaPxCf292KSKdRsq/Pxt jTiy1K8ykbteb59egthpgOet218jgHql/vRdBkKoUV7sBkPDtbZCEvkiP12qkkZUwRO4 SqdTS5gWQnx6858UAq78GLwUq9XcfjWsT9zz45VZQEw6lMnHaxRa3hr0W/1Ux44fKn5p fm1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eDEHuW50; 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 k9si11387895eje.184.2021.03.15.11.27.40; Mon, 15 Mar 2021 11:28:08 -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=eDEHuW50; 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 S235460AbhCOOa4 (ORCPT + 99 others); Mon, 15 Mar 2021 10:30:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:36622 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233125AbhCOOAo (ORCPT ); Mon, 15 Mar 2021 10:00:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CD6C264F00; Mon, 15 Mar 2021 14:00:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816832; bh=1LANfikIH4WX96lOTe4tjEdD+qWcOW6ze56Lfeyz/Dc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eDEHuW50y+8PTXmFRmk0re9HSXUVUvqqIYKuEH5v1z8TI9GG+1d/ADTpqYcDDpI44 +F3Jbhng+IGkGVLGoMCNc/l9tyd1d3f1f3pc754q1Yq2R6YjYpxCnJvnAMZOQDnnvY WoJ3bCOw4EEdzem+U9hTk0fszKkfoTYfQazuLGc4= 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.10 139/290] Platform: OLPC: Fix probe error handling Date: Mon, 15 Mar 2021 14:53:52 +0100 Message-Id: <20210315135546.613063755@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@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