From patchwork Tue Oct 27 13:53:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 312320 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 486B5C55178 for ; Tue, 27 Oct 2020 16:29:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 08E9F20829 for ; Tue, 27 Oct 2020 16:29:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603816197; bh=B7P7RTZKOunuboMRiYpUL2hPjTSrlkCVL3xQowpL4mg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=VcR1dXaGa9wUWtltrxGs1Nh0Ij7y04TG6dlxFpv1BPZwO4lEr1+PkTGla5lShYQWi hkr1/EVmmUKK/V+sKKtHeSqUkiHLEq31SKPBo3bQFZ5gAI1h65hSWhx7db3BRyLUkn FPaTJooBhbmSU5gAi87T8vO83QKzesLVX+QtpXio= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1802673AbgJ0Puu (ORCPT ); Tue, 27 Oct 2020 11:50:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:40474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1801902AbgJ0PpA (ORCPT ); Tue, 27 Oct 2020 11:45:00 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0FDA024197; Tue, 27 Oct 2020 15:44:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603813467; bh=B7P7RTZKOunuboMRiYpUL2hPjTSrlkCVL3xQowpL4mg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CRD4zCw71fZXG0FJa9DzZRvcMbRKeWqMUU/bD5YkgUeix4CWh/eX+KynZFitytxcj m7IeOdidlgul9s/I+7fuTROas0y2zz5r5+d7t7GAD77FTdfjggi5pKPzmb3/zBK2/7 VhyutSZMy9lYVu4p/Q7RqNFhEquFQ+BANt9TphGQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gwendal Grignou , Enric Balletbo i Serra , Sasha Levin Subject: [PATCH 5.9 561/757] platform/chrome: cros_ec_lightbar: Reduce ligthbar get version command Date: Tue, 27 Oct 2020 14:53:31 +0100 Message-Id: <20201027135516.815959536@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135450.497324313@linuxfoundation.org> References: <20201027135450.497324313@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Gwendal Grignou [ Upstream commit 1e7913ff5f9f1b73146ad8522958bd266f22a510 ] By default, the lightbar commands are set to the biggest lightbar command and response. That length is greater than 128 bytes and may not work on all machines. But all EC are probed for lightbar by sending a get version request. Set that request size precisely. Before the command would be: cros_ec_cmd: version: 0, command: EC_CMD_LIGHTBAR_CMD, outsize: 194, insize: 128, result: 0 Afer: cros_ec_cmd: version: 0, command: EC_CMD_LIGHTBAR_CMD, outsize: 1, insize: 8, result: 0 Fixes: a841178445bb7 ("mfd: cros_ec: Use a zero-length array for command data") Signed-off-by: Gwendal Grignou Signed-off-by: Enric Balletbo i Serra Signed-off-by: Sasha Levin --- drivers/platform/chrome/cros_ec_lightbar.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/platform/chrome/cros_ec_lightbar.c b/drivers/platform/chrome/cros_ec_lightbar.c index b59180bff5a3e..ef61298c30bdd 100644 --- a/drivers/platform/chrome/cros_ec_lightbar.c +++ b/drivers/platform/chrome/cros_ec_lightbar.c @@ -116,6 +116,8 @@ static int get_lightbar_version(struct cros_ec_dev *ec, param = (struct ec_params_lightbar *)msg->data; param->cmd = LIGHTBAR_CMD_VERSION; + msg->outsize = sizeof(param->cmd); + msg->result = sizeof(resp->version); ret = cros_ec_cmd_xfer_status(ec->ec_dev, msg); if (ret < 0) { ret = 0;