Received: by 10.223.185.116 with SMTP id b49csp3581632wrg; Mon, 26 Feb 2018 02:29:27 -0800 (PST) X-Google-Smtp-Source: AH8x226+EPuQjJdBJMJJu3hnXz6ThbC8VNA8X9VDsuAFzpKtgxDN+FyEHjveH3N2cXssoI9AAgqw X-Received: by 2002:a17:902:b605:: with SMTP id b5-v6mr10257695pls.354.1519640967053; Mon, 26 Feb 2018 02:29:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519640967; cv=none; d=google.com; s=arc-20160816; b=RWPm2zhoVmWjFiQKW91YsOJPOnwygZYebprqS+F96VNYAOQGIwM4fXgJPjEXO3Vt/a lnLJjuqm6YdsSddiprn6lWAQAWPcp2rcUDQsPywhFBXqioe0dxmIbeiN6MS0wBFDQB9U ADQLHyialjI5orhNiqKR+dPzqd9aFcxZvET8Age2XH1IQkL1YYRA4zqUbsHYlrQOVHR0 PLJ+mpxIqg+4sYYZYDY1fPZ7MaPwxN2B6BsJotLe8dy96GrjJ9qdNk4tOmhSZHbTN7gv 2hyoTQmfLsTQHc6Lpa6AoknA0B2i9Eay9wYCT4aBl1/klst7F8VnrPdGqwFB/w0uDurG B98Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=12InN/p6sgxk4jUnXw/8pSX9jmGaIJvbjeK+yPqzfI4=; b=odxox5Sw1Q9JEPF3QIr3r8NvF7ODfc6bPbIpILEeIrvoqn/f2NjJX02vpBRwYXC8Cf COZnOXNNrEBMgethMxk5YdUqLQ7VdrUe64c5yC+pM7oTnFDMowBUSVe/XtwV8gL6o9qb X4Y6B4Z+8Mntzu5NCO1S6rtkXxFTLWl+cJdY/L/tXlqIIWZbDTrgn5gEhTTP/9NBnKke WpPWLdxwP4kJfE4SFaykk3An7sA2QEmruEu+tFEp7zQDXSucF9oosMyjbKrxBNUPHwir 17eRu20PwdmeidcPuSkNUlJQQ5AlX6lAYd4Xzb+0EAbPXSxx9Bx0bxX2O6CzLdG0L0cR +Kbw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2si2959911pge.465.2018.02.26.02.29.12; Mon, 26 Feb 2018 02:29:27 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752626AbeBZK0T (ORCPT + 99 others); Mon, 26 Feb 2018 05:26:19 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:48312 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752353AbeBZK0P (ORCPT ); Mon, 26 Feb 2018 05:26:15 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 8252E277267 From: Enric Balletbo i Serra To: lee.jones@linaro.org Cc: groeck@chromium.org, andy.shevchenko@gmail.com, kernel@collabora.com, gwendal@chromium.org, linux-kernel@vger.kernel.org, Vincent Palatin Subject: [PATCH v3 1/8] mfd: cros_ec: fail early if we cannot identify the EC Date: Mon, 26 Feb 2018 11:25:59 +0100 Message-Id: <20180226102606.15093-2-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180226102606.15093-1-enric.balletbo@collabora.com> References: <20180226102606.15093-1-enric.balletbo@collabora.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vincent Palatin 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 --- Changes in v3: None Changes in v2: None drivers/mfd/cros_ec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c index d61024141e2b..74780f2964a1 100644 --- a/drivers/mfd/cros_ec.c +++ b/drivers/mfd/cros_ec.c @@ -112,7 +112,11 @@ int cros_ec_register(struct cros_ec_device *ec_dev) 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, -- 2.16.1