Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2331442iog; Sun, 26 Jun 2022 12:51:51 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tkiX2Wp6nuyrmDPveLs6LiO9RcbNVR+SraYoblQnRkq3F3PX5+r4E5XM5+fNK0KIGnZeJx X-Received: by 2002:a17:90a:678e:b0:1ee:6ece:8592 with SMTP id o14-20020a17090a678e00b001ee6ece8592mr3430489pjj.201.1656273111251; Sun, 26 Jun 2022 12:51:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656273111; cv=none; d=google.com; s=arc-20160816; b=TLYEVAXR8670e788zuU86M6QmPl6nikQzR10PTPVMzdlTwDPKbycUJIamRDuHnEu0Q V4OgcbS7Xk/LRzhTI9hZiDFJZ33I0iXYrhJO2PilMAEWLNLnXKI5Agd3XjXg6AzKVoCB XuKzavMzjYqdGUk+xn4I4wTg5/8/I5NmO7InlQH8WrmnlAo0DU1cXYmHz8SwYqgWeO5O DWNSd/y+nG6FtuozqVHIN0ygmzloX6zj73/WeLmIz+huWycdvKMMXRFTamkSX3TkhE/u 7bIaeZXyzKtnUY00AHoWuCmG/WbPym/xcz6cW3DOFWWkuvRMpaaM4GSynd0LCuqdf/L8 T8WQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=lEoBpsPY4OUw7lmAUo+fgsLAozZ9T4wCcfenFLKoO+g=; b=XRzvNRBC0imP0Ikugp+uyjhHgJ5mKD+m9V9ryIlUAYDrFPJdVIOD2khOkVzr3e8eze Bm2u/rd3VN2GgiZO1COOx83kaeTXFO+C2bmfJRcqIhDmPl5B70mesUBXC8DZRrjsjDS9 DJwWuaYq08xHDXmAwFj2z4/tl0JZ/63PkzqYoVT+RWiA8vih62o4B8XaAwh4l9K7JWTR J+hT5aWME/jN8jAGR8dxJt2u9YVKvTnhCIb/XFNImIeaNWiWxKQld4MEskM5rjk1dPoT wDoDoON4ugnTh+R7Zqr+pVgVQWsKEea5Ukdf0LRj26OCVoDSDXX6W54PfHtdTB4m6fFW mIeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=D4wzJ7IY; 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 z33-20020a630a61000000b003fea0415b5asi11354472pgk.834.2022.06.26.12.51.39; Sun, 26 Jun 2022 12:51:51 -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=D4wzJ7IY; 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 S229895AbiFZTm4 (ORCPT + 99 others); Sun, 26 Jun 2022 15:42:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229593AbiFZTmz (ORCPT ); Sun, 26 Jun 2022 15:42:55 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 153D9260; Sun, 26 Jun 2022 12:42:54 -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 494872222E; Sun, 26 Jun 2022 21:42:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1656272571; 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; bh=lEoBpsPY4OUw7lmAUo+fgsLAozZ9T4wCcfenFLKoO+g=; b=D4wzJ7IYgZ6JbrhL9SoZHXJnJ+F4HacDL4eLMms2aZ5Bg1X1IEeiV3l9RXReojCe/xpzfC YTZ0NHkpW0T89z18vBsZ5ST/tnaUcs05cuyL3klJVGYt3xxB+YUoiN+FWNy/vQ8St1qI4C 5Qilsm9uNw6slUKTEeLUxAsIE1EdmXw= From: Michael Walle To: Charles Gorand , Krzysztof Kozlowski Cc: =?UTF-8?q?Cl=C3=A9ment=20Perrochaud?= , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Walle Subject: [PATCH 1/2] NFC: nxp-nci: check return code of i2c_master_recv() Date: Sun, 26 Jun 2022 21:42:42 +0200 Message-Id: <20220626194243.4059870-1-michael@walle.cc> X-Mailer: git-send-email 2.30.2 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 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") 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)); + 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