Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2362377iog; Sun, 26 Jun 2022 13:51:50 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uCnt3zNVb07PTIK6JlUPOzcSWqIxeWftOHJEQw+D3S9yCZVE/Ds8khSCKp+/ceHcS/A6Gh X-Received: by 2002:a17:907:7256:b0:722:e5a8:e3a3 with SMTP id ds22-20020a170907725600b00722e5a8e3a3mr9636688ejc.599.1656276710149; Sun, 26 Jun 2022 13:51:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656276710; cv=none; d=google.com; s=arc-20160816; b=CwHYDSCbNLs+grd/nrHSl+jZf+96/KNqzaBI7237lo7A4mBna6j3vfZCkHNef+Ex07 dFZQ495O1dQNl8uYuLf9sM+Sr0kxTpFGaelccgW05E72NqvbAn1dLuXegjoxV5m85xTc haV4jbzf/51Et1e9m9CxVJ56PDf29JR1YR8A7wUDZKM89A6QPbnzNqvj+S0mtEMI19/G +mok5zc0zLIZwuooScmcJUd6QpCnyvH3drkdWs4e8QfoWuCqvO8JyF6qJpkhvZ/c/3iE i4Cs7gG/Wbh1dqAp4izT1PQvPxwIq+JisUnn3YxGuFtbny/IHJ00hsk6TTH74g4tX62l 41mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :dkim-signature; bh=tx44gz4c/mqxeeGkG/B8AgM0VUfKCxNhrmmznwu4ypk=; b=kTXjSYBVxmyF1fFTr1xeMPqx7mqYOfK/qvdl6jv7lDez31naEqTnPQZOFsMVw34fZ/ izU0PoBEha9jTPvhYqza2xkaSM8AlqozLFBx6IBQCjL8JLrBtgRYalseBb9G6u98Tvyp Apch8GE+7rtHxiTdj+KlH8RzATlvgA1jqvk+xP/6Dgc4V875I/nFbh7XW56yXxhLpcy3 Z/9Hd0Xm/+Diz8fwsjTpYjYg8wXl69rKMGFdp7a+VgOksbaoIQ3c5lnAFShoAGoYeR9A 64HShBhILq7an8eGVYXoNP6z3oeVkaMfD9vzqXXhHskorGQT0kz3D4YAgd8CpW5Zv+8I POEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=Ot6dT2qR; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t19-20020a50ab53000000b004359a63823esi9842344edc.225.2022.06.26.13.51.26; Sun, 26 Jun 2022 13:51:50 -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=@walle.cc header.s=mail2016061301 header.b=Ot6dT2qR; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231583AbiFZTzV (ORCPT + 99 others); Sun, 26 Jun 2022 15:55:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbiFZTzT (ORCPT ); Sun, 26 Jun 2022 15:55:19 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCCA038B9; Sun, 26 Jun 2022 12:55:18 -0700 (PDT) Received: from ssl.serverraum.org (web.serverraum.org [172.16.0.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id ECB992222E; Sun, 26 Jun 2022 21:55:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1656273317; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tx44gz4c/mqxeeGkG/B8AgM0VUfKCxNhrmmznwu4ypk=; b=Ot6dT2qRBPEZu49hPQNVzQJmsAE/znuYp5WxIv1wDC6zNLkkVQUlOKXZfds6Gyi5RmNbPW tV2DHmrEcWhahlQ2j1bo84Oe04FkqEr1LodSpXtKboYP2F6JlSrZlM7Kk7q7/IFGP7Ioaf WNdFIfVCn5t8/FrFNSud4NoaPs2v8S8= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 26 Jun 2022 21:55:16 +0200 From: Michael Walle To: Krzysztof Kozlowski Cc: Charles Gorand , =?UTF-8?Q?Cl=C3=A9ment_?= =?UTF-8?Q?Perrochaud?= , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] NFC: nxp-nci: check return code of i2c_master_recv() In-Reply-To: <99e3ad4f-077a-0ca0-6842-b0c5a3439b68@linaro.org> References: <20220626194243.4059870-1-michael@walle.cc> <99e3ad4f-077a-0ca0-6842-b0c5a3439b68@linaro.org> User-Agent: Roundcube Webmail/1.4.13 Message-ID: X-Sender: michael@walle.cc X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 Am 2022-06-26 21:49, schrieb Krzysztof Kozlowski: > On 26/06/2022 21:42, Michael Walle wrote: >> Check the return code of i2c_master_recv() for actual errors and >> propagate it to the caller. >> >> Fixes: 6be88670fc59 ("NFC: nxp-nci_i2c: Add I2C support to NXP NCI >> driver") > > The check was there, so I don't see here bug. The only thing missing > was > a bit more detailed error message (without cast to %u) and propagating > error code instead of EBADMSG, but these are not bugs. The commit msg > should sound different and Fixes tag is not appropriate. Well one could argue the nfc_err() is very misleading as it prints an unreasonable large number. Will remove the Fixes tag and reword the commit message. >> Signed-off-by: Michael Walle >> --- >> drivers/nfc/nxp-nci/i2c.c | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c >> index 7e451c10985d..9c80d5a6d56b 100644 >> --- a/drivers/nfc/nxp-nci/i2c.c >> +++ b/drivers/nfc/nxp-nci/i2c.c >> @@ -163,7 +163,10 @@ static int nxp_nci_i2c_nci_read(struct >> nxp_nci_i2c_phy *phy, >> skb_put_data(*skb, (void *)&header, NCI_CTRL_HDR_SIZE); >> >> r = i2c_master_recv(client, skb_put(*skb, header.plen), >> header.plen); >> - if (r != header.plen) { >> + if (r < 0) { >> + nfc_err(&client->dev, "I2C receive error %pe\n", ERR_PTR(r)); > > Print just 'r'. Personally, I prefer seeing the actual error string and this idiom is also used in other drivers. But I wont insist, will change it. > >> + goto nci_read_exit_free_skb; >> + } else if (r != header.plen) { >> nfc_err(&client->dev, >> "Invalid frame payload length: %u (expected %u)\n", >> r, header.plen); > > > Best regards, > Krzysztof -michael