Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3522017pxf; Mon, 15 Mar 2021 11:25:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4R5tMHHkkuuiPPZqQngSsJK90cqkh5dj143oCUPE+cgIQJrRR1Rh0RRAZHaFxKgm9N5WG X-Received: by 2002:a17:906:1a44:: with SMTP id j4mr25489166ejf.401.1615832723097; Mon, 15 Mar 2021 11:25:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832723; cv=none; d=google.com; s=arc-20160816; b=zytXNUrBdivABh+Fzolc1cct4WjFTUeF9zjBWOmqF/FzRvHtk0QOCbYgVQMv5MsOnf JLpgFY2/FlzAjxi7zoBajWpl/GBLVlKbim9Qqy6wTkHZNHPKjoKFAHOwPFq8r9vAcNfE wp7NUsDwv05Q1j1Y8hbuxpuQEdblbin4tX+4FURxfn6v/KH4tQRSX4ry1IiwZkyGxnT9 q8PQqFj+Z7YUmKb1lp/Hkjc3+6Pi87X4g8h0tx/ODx/TNYSbREabPOARuIV1kvrSGSC0 UemIwWCVYsRVGjEW7Jk6vVR3n3m99X6sVmRTn0rcYjyzBA2Axv8FLfjXpNDlUBvs5+Bi zgWw== 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=KIfXG2ZPCcTUd4JxRsQ1t+JOex9XHDaCCNmyQY7PhMIsmbTnZH/N0enbZXhKMYsVO1 ua0YvhgXXgqtX07E6PCv3KrEwnoxkqNmbB0fDkG5JUx5qGrTeEmXazazICKRRcd1rbWv xPa064YORUj+tRboHoDM4ezZ/S4AcjsW5wiXQUPaM9Gm7hymNL5N6lhmnpGkNe2jU/NU wm4FCX6F6QlKPTeABoufDDXXkNquNrDaZW+UcY8Jl2ehgDrcD5eQiBWiiU+qJlX9iZ+B TdJ1E5Ferkc5Is5kaH6WymU+p6PtgOhhI8dPJaC31xHagLDeM1PNDYGaXD5LZAuFPOjZ mteQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1JWr7WXc; 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 mb15si12397494ejb.147.2021.03.15.11.25.00; Mon, 15 Mar 2021 11:25:23 -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=1JWr7WXc; 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 S234158AbhCOOZa (ORCPT + 99 others); Mon, 15 Mar 2021 10:25:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:37540 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232952AbhCOOAV (ORCPT ); Mon, 15 Mar 2021 10:00:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CF90164F5D; Mon, 15 Mar 2021 14:00:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816805; bh=1LANfikIH4WX96lOTe4tjEdD+qWcOW6ze56Lfeyz/Dc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1JWr7WXcYtuHfvJfwGjIsgweDcKkZd0zST+CVVGrRiq3hRKrhAFms3WBkKwASRXdq 1A9N0m0KXqbkyN7uEdD87sxTLSM/nx/HKh27rLyRPCAwF3iuXheWXOURtqoEtdGDeY 7eWNiIVEzkVxUU8HEkpRzAhcCRS+Iw4m/ksmYu2c= 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.11 135/306] Platform: OLPC: Fix probe error handling Date: Mon, 15 Mar 2021 14:53:18 +0100 Message-Id: <20210315135512.214850549@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@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