Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp199665iol; Thu, 9 Jun 2022 01:56:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRKZrPCqvsX9vr913e+5cvcKtTovWlGpD+0Jz57qydtXtodEFQt09hQxwVCIOznov4Wpjl X-Received: by 2002:aa7:9f84:0:b0:51b:b64d:fc69 with SMTP id z4-20020aa79f84000000b0051bb64dfc69mr6860761pfr.7.1654764986041; Thu, 09 Jun 2022 01:56:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654764986; cv=none; d=google.com; s=arc-20160816; b=X0QOf1B2BXqVcjrIC8jg9nTG2Xq0v8oleqRt/SGKvGlh4s1tiaXo17DYQmJ+813lMP JPhhsVtY09ZygREBxWFSbYQeADGBrdC0Kl9rXpYzV7fuPEgW/5htoHdSM4Hwo6+APEJP o6bSQ9tjC4WKVMoWLwerYfmmjwGOSowP6DDF+xr1Bf4MzIQIpauS6DHkauS9rN6tnH1P LO/dxddeNzJkBQLRXcndeqSkz+nJHWcrLm32DOHxFArOWhaos43PhcRlSzdYBfTEPyxQ 9rsPGc77xMUx9vzPPAPvJtBKOoI1Mh2f1OcvXzuu3f7QV4FFFvMET5xZqS8iWD3n7cde MW2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=PckgIW96SNM3LYer9mevtxdGSjsyeeznQinAQOeYRFQ=; b=b0hgNHx88b7X8KMh3tYqoozr8gUpsrBq2mJ1pf6P7HtqVRfUjsNLNzJ2x4tHab4Dy/ yM4ivxpO/gn+NOJ5N9D6hNTlwvQLj8GWriJ73880AD9tZqnIE6JLsa4tR2/IAwdp1jO6 lW2RkF3frwL3YfxGDb1Fw/7W8cLh6wBnqfHGc8DF5aQNLFeH9u7oJb7HIDFceRiU0C8Y 3oMG+kpU80kw01GzmzIQZV5biVr/B1yqoBR7YBMokL0LvXbzrR4kAmxgtUQGY8kCuJD7 OKNBHTp5G1nO3G/dbS8SP9jZzuQWLTLMn6eQ8glK48jZI9BF7HeYHAwCVoJA/GFIfciR sugw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="pK5/r8u4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u18-20020a17090341d200b001587f099641si31491431ple.387.2022.06.09.01.56.14; Thu, 09 Jun 2022 01:56:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="pK5/r8u4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242058AbiFIIsJ (ORCPT + 99 others); Thu, 9 Jun 2022 04:48:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242055AbiFIIqH (ORCPT ); Thu, 9 Jun 2022 04:46:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D7BD14768B for ; Thu, 9 Jun 2022 01:44:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 23686B82C7B for ; Thu, 9 Jun 2022 08:44:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06BFFC34114; Thu, 9 Jun 2022 08:44:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654764257; bh=3hObGWWzQZpFXvDPW5fCAcwb9Jy8tx9LjTKwNDUJr1M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pK5/r8u4v5tOYCLkflFk6wwMIP0XY8kMSENnRIzo1TkrjWgWLGBoflvpZwkGVOsvL BKvsiyEvXdC/Xa759LsZnPUZ53DSqrSvcnXhekRSNzUj3a0BDiJzKUxF9AZ2nSdDFN EXHwZv2CPqKNryZuSmiv/nWSMKvxDs8KlBgVVdCTWMsOhPUgfClHvg9ZDi9v+0T3S1 2ta9TbXecWAEVBl3XfRatCNDUysL3976VCDe5X7N/cbk9kkDbBkq9SEySzLphn4hkm JhYVGiO2cw8DqdHE2jEwU/PxBlSKYIcVDa3Lp5nyLdLvViZfbgiHvXA4UXECllHh0/ XtoMxTyO2JKBA== Date: Thu, 9 Jun 2022 08:44:14 +0000 From: Tzung-Bi Shih To: Guenter Roeck Cc: Benson Leung , Guenter Roeck , "open list:CHROME HARDWARE PLATFORM SUPPORT" , linux-kernel Subject: Re: [PATCH v3 16/23] platform/chrome: cros_ec_proto: return 0 on getting cmd mask success Message-ID: References: <20220608110734.2928245-1-tzungbi@kernel.org> <20220608110734.2928245-17-tzungbi@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 08, 2022 at 09:20:29AM -0700, Guenter Roeck wrote: > On Wed, Jun 8, 2022 at 4:08 AM Tzung-Bi Shih wrote: > > > > cros_ec_get_host_command_version_mask() used to return value from > > send_command() which is number of available bytes for input payload on > > success (i.e. sizeof(struct ec_response_get_cmd_versions)). > > > > However, the callers don't need to know how many bytes are available. > > > > Don't return number of available bytes. Instead, return 0 on success; > > otherwise, negative integers on error. > > > > Also remove the unneeded `ver_mask` initialization as the callers should > > take it only if cros_ec_get_host_command_version_mask() returns 0. > > Make sure this compiles with W=1. Compilers may think that ver_mask > may be uninitialized when used. If I tested it correctly, it compiles. $ make mrproper $ make allmodconfig $ make W=1 drivers/platform/chrome/ ... CC drivers/platform/chrome/cros_ec_proto.o CC drivers/platform/chrome/cros_ec_trace.o AR drivers/platform/chrome/built-in.a CC [M] drivers/platform/chrome/chromeos_acpi.o CC [M] drivers/platform/chrome/chromeos_laptop.o CC [M] drivers/platform/chrome/chromeos_privacy_screen.o CC [M] drivers/platform/chrome/chromeos_pstore.o CC [M] drivers/platform/chrome/chromeos_tbmc.o CC [M] drivers/platform/chrome/cros_ec.o ...