Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp849008lqj; Mon, 3 Jun 2024 02:41:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU8hbdAqy1U+UJ0RsGWosp1Zy67SZpiqeZXGuPyPiTB0S4nbSL/4UA+wvEmnb+gKE9JVF5cYNt86gbPmUf9sb45jWQIyQnDBsidaPUo6Q== X-Google-Smtp-Source: AGHT+IGvgGmamORUF7usGZ8CqfLVKIUxpBWQ/9FEspgfP1Te+GCASnaPn6yFxbj/6/60dhphJKhk X-Received: by 2002:a05:6e02:2194:b0:374:9916:88 with SMTP id e9e14a558f8ab-37499160267mr49868005ab.10.1717407712603; Mon, 03 Jun 2024 02:41:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717407712; cv=pass; d=google.com; s=arc-20160816; b=uEo2x4qqPoL5BqKRVYNyTvvUO0OJ7z3JIByHMXighwTtkmrmSKCxrsnoAsBHl2nIYn NeEfea56BSEtHg3jyFgxHutQAT4cjouGMPLSfZPq0SAb3KVDQkgjiqOAprpvzBcz+TFh rHq3DoWfXgWanGzDOagCXubb5SaG4y/5SrrK0XVX+FJtXYtJutBRjXQ7Y/Qh6s1EjkHz Sf/DLM08xaKrU6ClbhPL/bShOrXHjsTJDEJ+MmRlrrB9bP4KfBxIIDHLUrYX1tcdZ3iv hOifpeEsOqsOP5n3suq2x62dlKO5HkL+7PGZHUo7LDCoWbI2mce2fXfqBi7vTSp9gqTS fjiQ== 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=+Ksk+h4qbuX6qulf+n51G45nImvAaZ+24Dd08B96u5M=; fh=O7W32hzrxLioy2lU7cq0myUffGADZNPHRUPmOpshY3A=; b=R5UgCAP5sdh6dSrXKb8XduJ64zeZyfuJblCFouAZh3Hkg9kwQYpnGwHJuZ1ooQZiRb 3zYTBSAMWN8eyaQcis8lmwJz+CYU+ECjoqP4v8WAQPGSlp45ZAlnrBrz7mYAttfYxuC+ LFkY44MhfMKhKTp+PVZz0Bh21y19Bg8tf4r9aT6K1VTi3yTGbinmMJGxWuOHfOv9b0ZT Dj3KwKD1HQD4amJDgmGuAX7LKfJMTmbjEh809GpTzvqEVeANBKYp9a1Q7gn5s+ANreOu 3HhbeokR4UT+M7Sq0OCrkevOk2GXsSGFYgog8GlDdhsanShWInuEyuLzEcrtE6D/aLnU 3bNg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GV4RLdNE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-198893-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198893-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c3540faebesi6207135a12.5.2024.06.03.02.41.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 02:41:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198893-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GV4RLdNE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-198893-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198893-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 3D888288814 for ; Mon, 3 Jun 2024 09:35:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B3A7E84A23; Mon, 3 Jun 2024 09:30:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GV4RLdNE" 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 D58F612838F; Mon, 3 Jun 2024 09:30:28 +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=1717407028; cv=none; b=sXRXyNBFhhrSMVoS2hN+BAP3L+mb7m/zaZ0XuRC7++2wxU7r6yZmrx3lqKx0kv//HJfP0DTQjDFIhja6OyXtPWb4ZMj9NN16/WyYBQOlFXp0Pe96vtaWZF8B3MG/y4whCOLc8FgLj/U8TC/UJorCHVe9qCyBcFnmGztTB735Tx0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717407028; c=relaxed/simple; bh=gyTvuIXkHMDKkIYNWRrOLwBVU/NHyELF/9o9YnpdpQM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KnSdIs5juPiD0b5ao8TldjIh/E0F8uRGY/epo9NyhoNCSC2Au1lpB3tz4etSnhDu369BilhbH5y0Ewhm7xut36mdBV0Qb1TxQWSlouXNiissD+c3miAeGI9fdmsYQTPvVIUizybrxRZw4EWh9mVo5hbS6xI+GmwIpU5jDYAynYU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GV4RLdNE; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D975FC2BD10; Mon, 3 Jun 2024 09:30:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717407028; bh=gyTvuIXkHMDKkIYNWRrOLwBVU/NHyELF/9o9YnpdpQM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GV4RLdNEe1Mg/g2Pcx5NAUep8ndltG+agPssIFjYkSkagmw206unOhFePjhotcvu4 liPqPZfE0KHfUEt2Md8DBITrZdMrmEznQp2Kul9WgT6x4kmakJBKGhYDUzQOox84B1 KD+5thwq1Hv968Wr0ZqKzggGluqm4JXHjHL0uZAXPjwI5vWi86MEZbGwhBJGzbCyXf RG0AEB0ft1iQRIA0f703VuHWzhXo+uU92aB474OpQLsiv1atonMyN3o0vI+9iKCSAH TEYT5G8AV4nzZWJrBpsLN1CO+YSuLUeMZ2G0/12GSYeY2kEM3grWY6uMMPa3MsRsgk pIvR+n6o7mp6A== Date: Mon, 3 Jun 2024 09:30:24 +0000 From: Tzung-Bi Shih To: Ben Walsh Cc: Benson Leung , Guenter Roeck , "Dustin L. Howett" , Kieran Levin , Thomas =?iso-8859-1?Q?Wei=DFschuh?= , Mario Limonciello , chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/5] platform/chrome: cros_ec_lpc: MEC access can return error code Message-ID: References: <20240603063834.5580-1-ben@jubnut.com> <20240603063834.5580-2-ben@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: <20240603063834.5580-2-ben@jubnut.com> On Mon, Jun 03, 2024 at 07:38:30AM +0100, Ben Walsh wrote: > @@ -425,8 +469,8 @@ static int cros_ec_lpc_probe(struct platform_device *pdev) > */ > cros_ec_lpc_ops.read = cros_ec_lpc_mec_read_bytes; > cros_ec_lpc_ops.write = cros_ec_lpc_mec_write_bytes; > - cros_ec_lpc_ops.read(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_ID, 2, buf); > - if (buf[0] != 'E' || buf[1] != 'C') { > + ret = cros_ec_lpc_ops.read(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_ID, 2, buf); > + if (ret < 0 || buf[0] != 'E' || buf[1] != 'C') { Slight concern: if the read failed (-EBUSY, because of the lock contention failed for example), does it still need to probe for non-MEC devices? > @@ -436,9 +480,9 @@ static int cros_ec_lpc_probe(struct platform_device *pdev) > /* Re-assign read/write operations for the non MEC variant */ > cros_ec_lpc_ops.read = cros_ec_lpc_read_bytes; > cros_ec_lpc_ops.write = cros_ec_lpc_write_bytes; > - cros_ec_lpc_ops.read(ec_lpc->mmio_memory_base + EC_MEMMAP_ID, 2, > - buf); > - if (buf[0] != 'E' || buf[1] != 'C') { > + ret = cros_ec_lpc_ops.read(ec_lpc->mmio_memory_base + EC_MEMMAP_ID, 2, > + buf); > + if (ret < 0 || buf[0] != 'E' || buf[1] != 'C') { > dev_err(dev, "EC ID not detected\n"); > return -ENODEV; Similar concern here: should `ret < 0` see as a -ENODEV?