Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp538455lqs; Thu, 13 Jun 2024 19:28:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWLmzsJ6iHGff+muEsDjj/5lHj/hQG8874qkWaU6BgfRmHjc0cmOES65Pl7ml6a7dAMagPIozR1gg0Os7kzEuJzlRih1bBZ4FRwzo5hRg== X-Google-Smtp-Source: AGHT+IGCNyKwJ5Y9gPGwsLzkj+vnGYMNJJjISja6Q6j8hAJcA/F0urNOujQHsH2qfZO2GR0o4cyZ X-Received: by 2002:a19:5e15:0:b0:51d:9f10:71b7 with SMTP id 2adb3069b0e04-52ca6e6812fmr988175e87.28.1718332098841; Thu, 13 Jun 2024 19:28:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718332098; cv=pass; d=google.com; s=arc-20160816; b=bY+JmeEXY+gvT1DQkTA2myYpXfQ0fOqJfg3U0N6s4VzV/lyB9qtwuS5Z0ZrQBmGRX6 gC803ls8cKUuMLUg9bUc/Z+HMe3m6s0HQABs2gnGUFBGWgjoWnxAohB6xAxdy2hWNqkf HauJ5DQEmyVrAoJSmWh6FkU1lQcj6AvbVzndfHmyCLR+VnNDVAeje0ijxQvElytxiBMQ 4aC3TOdYqxT8pc0uQZdTP9T8YlOzdP9QcgeWvH6WpeJ8tqQg4ttjz87yGTQZ2N0KgbpQ A8fl6nOr/HTreluKpdLYRxiuRxL7vSPUSWVGLkU26ZOujebSww/MIny7zzdLnVDQfCIn YVmw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=GX6X4LPinxbsRrEogLLBTVA1pyrau3j79AFlBIWfCpk=; fh=Zckubbkzew014Rh+h5ir9hTbOYl8wUSGHyo/AIlHze0=; b=QrW5z2kk/6ZhQ2RN73HHgPX38GcBUg26kR3J+WQlW+mv/gFmezo/itvkzTOzvk1pEu WWYrO6DeVo/OSfcrtr32js1VqThIibb2vsL4kb7H79xotmxmO1+av1I4aDJ+jgC2M1cM ApK6gu1t39xB+0/n6dAffA6h+f4zETfZMvptVGhREhdnOJ3Njp9pDmDAUDeMA6BMgiXN bJqPIhTyiOCaQwSby2tHffZq5ab1kgQhSdZbxWqR4bTizeEBr7znaOdz3c6kWgl0lKef vMCiMpTX5A7NGycD15MF576jB8CvHK6wGvYn0IG5cHpNGR1vvp8NsF3oD61U0fbktwzb juIg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oYwz+2Ok; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-214220-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214220-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f56d4c3e0si123187666b.251.2024.06.13.19.28.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 19:28:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214220-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oYwz+2Ok; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-214220-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214220-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4FEE31F245A2 for ; Fri, 14 Jun 2024 02:21:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E4BD183079; Fri, 14 Jun 2024 02:21:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oYwz+2Ok" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 803862AE75; Fri, 14 Jun 2024 02:21:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718331677; cv=none; b=tqaCShxScfrXK5WgsVSoRycrmd/g4gD6oSZh/pyOfiQu4l0KXSjC8zoUzw5UiDIvOTJ5i2xbyP4NDy1xtXdN117kLima9p5IKq4fbtG10Z2k+CS+ReOpOnNTQ60Cu5ciBGg5MOdqtUeY98Yqy5P0gn9j4wuCkXWZKY52ikBCgS0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718331677; c=relaxed/simple; bh=BNG0nAvaHGm3HWERpezfVrO8KZGZ2JvMeFwF0CQszUQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WWEiODehZ0lhMid4U5xPJzljCjE79wAv6c70wXABLbkHma7tGVgQS9St2CmjeUfNrosazo4fIRZAk0Cu4NNFZ7aNpW5gCkq7/LZi/WTCavadPhuWr7S3cu8H6oZjWnCwHyP+YHZUBFReRpOUEIR7ALw7K9/BQVIpzNvZwr8uYrg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oYwz+2Ok; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA239C2BBFC; Fri, 14 Jun 2024 02:21:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718331677; bh=BNG0nAvaHGm3HWERpezfVrO8KZGZ2JvMeFwF0CQszUQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oYwz+2Okf9is4/9hlucE2Oyd1SvFV2qx7OeIcUKUFzx99mRCN/CDhihLCXgHdI2L/ ekPPpDh1B/153moJ9XJGFgV8BUAQGrMGq/dxjYsESYJqkskzrv4tspk6LeXPS89AKv SccrLYtjI74cHL+yNk3k+/WYzvgNt38uGAG9eO8LX5Yv+cvygDSYWLsAWNLx9bRYvV 6wggHmIeMsYSmOEXj0LD0kUmqcJAGR2tZsjDzTrK0A0a55aCkv0c6qJt1gdF5CAsB2 vYUdp+wyQeH61im70SKWz7zIQB3KUEq7dJQlcjVZPTrqn8Em5NvaVytAF2F13vamkC 6THrVKVaA1oug== Date: Fri, 14 Jun 2024 02:21:13 +0000 From: Tzung-Bi Shih To: Ben Walsh Cc: Dan Carpenter , Benson Leung , Guenter Roeck , chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] platform/chrome: cros_ec_lpc: Fix error code in cros_ec_lpc_mec_read_bytes() Message-ID: References: <87sexgrdk4.fsf@jubnut.com> <87o784ac55.fsf@jubnut.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87o784ac55.fsf@jubnut.com> On Thu, Jun 13, 2024 at 08:14:14PM +0100, Ben Walsh wrote: > Tzung-Bi Shih writes: > > On Thu, Jun 13, 2024 at 05:51:39PM +0100, Ben Walsh wrote: > >> or 2. Put in a check for length == 0. > >> > >> or 3. Change the logic in `fwk_ec_lpc_mec_in_range`. Although I'm not > >> sure what the correct answer is to "zero length is in range?" > >> > >> I prefer option 2. What do you think? > > > > How about drop the length check at [2]? > > > > [2]: https://elixir.bootlin.com/linux/v6.9/source/drivers/platform/chrome/cros_ec_lpc_mec.c#L44 > > > > This works, but we still end up calling cros_ec_lpc_io_bytes_mec() with > zero length. Although this seems to work fine, we could put a length > check at the top of cros_ec_lpc_read_bytes() to avoid it. I guess you mean: cros_ec_lpc_io_bytes_mec(). Ack.