Received: by 10.223.185.116 with SMTP id b49csp807487wrg; Fri, 23 Feb 2018 07:07:52 -0800 (PST) X-Google-Smtp-Source: AH8x226fDBtBUOF3KhhT285cpye8MUvdvQxOexnYG5tlKbbXGoaTh1pZoC/g2VqzHjgCAnIE5TDj X-Received: by 2002:a17:902:aa0b:: with SMTP id be11-v6mr2005648plb.250.1519398472003; Fri, 23 Feb 2018 07:07:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519398471; cv=none; d=google.com; s=arc-20160816; b=NQsO2tG+x+F4cLnv25RGOVk/77UndYJAsfKTKSN3KBo4zCwBiXvQ0Dut81WxRQZJAR 4M1PlRGzM0zRGRDcPh1JnW+dq3FXsolRydikjXlBmjxzGpB5afLLRBye9ZpaCf4kJQvr 7hOYGr67Qx3LwXorASTVc3d6FOdGMlK1D+D1kI8Wz0tcI3UqjLjfDgl6wJzL2uydtLLd MT6rP7jxy43LWOvBo8Z8zCu6BLL6/r1ZcXVHnj5L7NdNwQ7jbpJD/PqD1yPXpnmYI9x+ AzW60yMGtYHfCH2nMjW+d+Lk8M0IRdGSkGGp5SZCTgMl4PMYmdKOZn8SCWO1ikwSUd57 /ZDg== 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=x+v+TOkc30m5zNorhF8k5qX2pQXPpYRv76Ei4D/9l2o=; b=FuYcOOQb1l0lE+0hSmhWlLX7W2Pnqn7IAQwbhmpxalQ/dyCNTZ4nB+Mrmxq2xxc9hW JguXIioIzH9eTUqu4mzAs4XYfPBjcfP0aOHA5x+OV4+G6Jzmyj4o046KMJjRjQz2RMeJ UY5zdl7lMohthkmC38KdqQPmGFqJxdSmOFczSSrtsxQdK92GnCU+lZMvOdRltzehuYdP C0W6q8bOR+rhZtl4M310SrR4MduqzkG2pZKPOxTrltnbE6qNT1n742XVPybPcObf0j8u sS40RjDaIcz6ErqwpN88fGrPoX99jlVCBHH/PbRvpj0Gu+oCQAt49ZyWT/BcFeg+wYBl e7ng== 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 h34-v6si1905766pld.26.2018.02.23.07.07.37; Fri, 23 Feb 2018 07:07:51 -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 S1751699AbeBWPGT (ORCPT + 99 others); Fri, 23 Feb 2018 10:06:19 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:37266 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751351AbeBWPGQ (ORCPT ); Fri, 23 Feb 2018 10:06:16 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 2F8782733B1 From: Enric Balletbo i Serra To: lee.jones@linaro.org Cc: groeck@chromium.org, gwendal@chromium.org, kernel@collabora.com, linux-kernel@vger.kernel.org, Vincent Palatin Subject: [PATCH v2 1/8] mfd: cros_ec: fail early if we cannot identify the EC Date: Fri, 23 Feb 2018 16:05:58 +0100 Message-Id: <20180223150605.10417-2-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180223150605.10417-1-enric.balletbo@collabora.com> References: <20180223150605.10417-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 --- 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