Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1148692imm; Wed, 1 Aug 2018 11:00:27 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdrSBxLwNDuOFNsnZ8TrauRYri2n8RMPigMMjAE2gGwJ0H8lNY/6KYo20EqoO6skRO2jBwz X-Received: by 2002:a17:902:20e9:: with SMTP id v38-v6mr25875692plg.107.1533146427207; Wed, 01 Aug 2018 11:00:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533146427; cv=none; d=google.com; s=arc-20160816; b=Tu+2+o22Y8Si01vOiJkpu4M7jRcNkOdP8l4C1LdT8/b00GYXsmcZFpQmHk18Sw2pQi poWGCbYal4Nahtt007HRyzssslePgHIwhDIHMGvL9X7VdsBSWAb4qyYpXeoTn4jE9jYd yM675iGTXU5ImxEY7v2s04GUV0+oRflX6CHg0xHexVAklGgwx6I0opSbu8AZtO/WYnWH A9KtfHOyIHSP+4UnWS+jA+Rcn+AOvTHGpvtDhvDXqfzJjv99r8KloHJi12QdtpTw1W+F jvuFHZWbMvFWMAJPKDxzvI8kGlpCDpyiYDMKOXOcbEZCZmrZeY0p00W0svLI1LEEF315 aKPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=MZaS8axROdvAu9SsK0ymAylQVf1rBUG7mnAFbwV7tio=; b=jFb5x8e4ahY6mZ1/GMawQ9t0p72I3hEvNO4QeGP1m6eRrPKWHiOsee28oqvb0Wg+0Z pQ8MA9WZQpQT9Pa8SKzYJa2rafjQXTAxRGMd/7/DAxA0elw1indDpoyQrMttTblstlqQ MUcBFq6ENUuROscvTARKKdr4zcvgIQKkBLfj/xUdG/klTdNNb9PvBwGUJfa0wq3g6iOn hXuprFZTuKlMfIaoYIEbGFywvDVkNf9gjEBPjZSnww28XWC4oZMP+g4gOpEBpGF8/Npa 2zkGwX8phdRnA/HIkX6TIBe17Vtr6uVGBRe7CeCJomug1Rx5vKFyU9nJNEo71ThiMr+1 j0Tg== 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 c4-v6si15824324pgc.284.2018.08.01.11.00.12; Wed, 01 Aug 2018 11:00:27 -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 S1732539AbeHATpi (ORCPT + 99 others); Wed, 1 Aug 2018 15:45:38 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:50080 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405933AbeHATIj (ORCPT ); Wed, 1 Aug 2018 15:08:39 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id DB96F1391; Wed, 1 Aug 2018 17:15:35 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Palatin , Benson Leung , Enric Balletbo i Serra , Gwendal Grignou , Andy Shevchenko , Lee Jones , Sasha Levin Subject: [PATCH 4.14 076/246] mfd: cros_ec: Fail early if we cannot identify the EC Date: Wed, 1 Aug 2018 18:49:46 +0200 Message-Id: <20180801165015.351751032@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vincent Palatin [ Upstream commit 0dbbf25561b29ffab5ba6277429760abdf49ceff ] If we cannot communicate with the EC chip to detect the protocol version and its features, it's very likely useless to continue. Else we will commit all kind of uninformed mistakes (using the wrong protocol, the wrong buffer size, mixing the EC with other chips). Signed-off-by: Vincent Palatin Acked-by: Benson Leung Signed-off-by: Enric Balletbo i Serra Reviewed-by: Gwendal Grignou Reviewed-by: Andy Shevchenko Signed-off-by: Lee Jones Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/mfd/cros_ec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/mfd/cros_ec.c +++ b/drivers/mfd/cros_ec.c @@ -112,7 +112,11 @@ int cros_ec_register(struct cros_ec_devi mutex_init(&ec_dev->lock); - cros_ec_query_all(ec_dev); + err = cros_ec_query_all(ec_dev); + if (err) { + dev_err(dev, "Cannot identify the EC: error %d\n", err); + return err; + } if (ec_dev->irq) { err = request_threaded_irq(ec_dev->irq, NULL, ec_irq_thread,