Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3153827iog; Mon, 27 Jun 2022 10:13:28 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tkFhfGNGEQ/o0YxzKf1BYO5XLKW+PMYvkcC9+S+rClurnziCs3c7PncwLcWmnwnwbzOqIO X-Received: by 2002:a65:4501:0:b0:3fc:4895:283b with SMTP id n1-20020a654501000000b003fc4895283bmr13824265pgq.231.1656350008511; Mon, 27 Jun 2022 10:13:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656350008; cv=none; d=google.com; s=arc-20160816; b=NHLIdW5mEsIy1gdLeOYgcoomBzP5CFKt94ku2V1ItTPxBxYAs+QYQFv7105C2Oi587 JjW61dn13UFiBqsI+0Q41YBrcBZJDmi/JXAaxruIAwH8alr10+kBZzv8d7Eejxi3hEMN 1DHmwjwESuQVwQY9iBoKQ4xVqw98DtsG+0mJxrsOwz6t3e1FlnDuxcJjoDgp3kx9hGo7 x3IhRj/nk0eKHa46vVxCv2er9Q0HDFnq4oaPglLV1s9DyKwBGqPJtXOXUGR4QbmM0J04 rVyDn5r00xSl9rC/VoKwvGJsodaCE5JlkHPzu2ie24SkyR7PRGgaI3p0/dgsQ5HTY5Zi 2W2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Kra5h0wwW4GQDM8Vbkzfd0KEGUN+KNxA9BZZU6Z+J00=; b=v6HHJ+UhD1KFM5XfK/rkQS287ELfU0SJ8i5jhwgvt8gZxjU5rhYxaNkwqM8WaTnHue XEH8Bn2do6lGEF6FLP/Z16uZR6/OggLOIxgzc6MYCfy1Su4lNoXvP7LOoXMG4YswDaNV C4USmHUVBbYHHuB9QyGUOXGU8B0M5soT/g1tDGX1ZWpXQrA+C3d33+Ior219L0JT1Jmd 5S4MAXjx28g3o+KNA1xIjSJjHYOS9L+cxfVBMjOUJdgsvnh2h4xphdSnNVVWa8M4n/fb 0vxqsHwH3+0xYWBTWnli1oHro8UKM2y1I/ccYi0QkBgVYEWbsx4ML9zi+d5xjIZ5QBOq fWgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b="S5mci/UI"; 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 s24-20020a170902a51800b00163bad6ec7bsi14367880plq.613.2022.06.27.10.13.16; Mon, 27 Jun 2022 10:13:28 -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="S5mci/UI"; 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 S239782AbiF0RG4 (ORCPT + 99 others); Mon, 27 Jun 2022 13:06:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239775AbiF0RGx (ORCPT ); Mon, 27 Jun 2022 13:06:53 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31FC118E0C; Mon, 27 Jun 2022 10:06:51 -0700 (PDT) Received: from mwalle01.kontron.local. (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 88B4322248; Mon, 27 Jun 2022 19:06:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1656349609; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kra5h0wwW4GQDM8Vbkzfd0KEGUN+KNxA9BZZU6Z+J00=; b=S5mci/UIJbSVWEQAwBeIJM+sT+GFn8WvKbFjOjoLCb1JMImLy+Htzz2TABfileY8SiMjAV l3yKwPwqDpty0lS+2nv1nbqPWRL5w7iEsVuO9GKpt3dtRtcWTBhrrp1yCQuykSKb5IYRxS bgQ3s4xZ/eXhMawljCzc7uWJeZxNXN4= From: Michael Walle To: Krzysztof Kozlowski Cc: =?UTF-8?q?Cl=C3=A9ment=20Perrochaud?= , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Walle Subject: [PATCH v2 2/2] NFC: nxp-nci: don't print header length mismatch on i2c error Date: Mon, 27 Jun 2022 19:06:43 +0200 Message-Id: <20220627170643.98239-2-michael@walle.cc> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220627170643.98239-1-michael@walle.cc> References: <20220627170643.98239-1-michael@walle.cc> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Don't print a misleading header length mismatch error if the i2c call returns an error. Instead just return the error code without any error message. Signed-off-by: Michael Walle --- changes since v1: - reworded commit message - removed fixes tag - removed nfc_err() call, as it is done elsewhere in this driver - nxp_nci_i2c_fw_read() has the same issue. also handle it there drivers/nfc/nxp-nci/i2c.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c index e8f3b35afbee..ae2ba08d8ac3 100644 --- a/drivers/nfc/nxp-nci/i2c.c +++ b/drivers/nfc/nxp-nci/i2c.c @@ -122,7 +122,9 @@ static int nxp_nci_i2c_fw_read(struct nxp_nci_i2c_phy *phy, skb_put_data(*skb, &header, NXP_NCI_FW_HDR_LEN); r = i2c_master_recv(client, skb_put(*skb, frame_len), frame_len); - if (r != frame_len) { + if (r < 0) { + goto fw_read_exit_free_skb; + } else if (r != frame_len) { nfc_err(&client->dev, "Invalid frame length: %u (expected %zu)\n", r, frame_len); @@ -166,7 +168,9 @@ static int nxp_nci_i2c_nci_read(struct nxp_nci_i2c_phy *phy, return 0; r = i2c_master_recv(client, skb_put(*skb, header.plen), header.plen); - if (r != header.plen) { + if (r < 0) { + 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); -- 2.30.2