Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2336328iog; Sun, 26 Jun 2022 13:01:17 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u6jqtezH81sBcV3Y903d4LTn5JSuRMomY9ugQHCje71ad3BYjeispgKYL2Wh//RImNKJOj X-Received: by 2002:aa7:d795:0:b0:435:7fc8:2d1b with SMTP id s21-20020aa7d795000000b004357fc82d1bmr12473301edq.201.1656273677353; Sun, 26 Jun 2022 13:01:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656273677; cv=none; d=google.com; s=arc-20160816; b=IQD8yEo6MbE8NRY//7f5UdE9n8t3RRbOOLE2b1GwOWBgU1sUXmdMdq9j0h0ePydUV5 rCBUdSb0Xe0kXbGaFj4s9BB9iMmv7xRXXMb/0prBs0pbePEI6QSvOCosTdQ5JaUxmmiS FhGI2GIQyXTXs9GF8LsMSfqxFazX1B0G6CVfoalREcHaTWVrmlOZz9i6zuzQGITIBGJ1 lStEVqAoQBGp+Q4w71v2DHmnvFOs5xZhtD7/mSIvvxuDnGLId3oxmt533Ga+CgSHdQi+ iPnf/h6+6sW4ufpu10Ks78vwU7UXlQ+q1uRDE/c6psIfmyGj6lL7VjKJhpLbAulpgLq6 HWQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=cvc7WQjIfQALH8uF/wWzX8UFQ5EmdXg7iLe0SD89Mqo=; b=fP/tEEzxRXoA6/SngjbSd4hjrLl0UFwbwaecEDAAmLxaFA/gWkheMYclM/s7N7OkGp C15PENKPCfw+y27OQWGByHUu9PSF/MYqU/J3PzvDDGBKhne0dUEFQ5PRgBphxqMfX4+E JVisLlYq72QHYmfwEx92capo3pWtyHcotNVJOXYV7hNEzz0W4hMFpUcqeiWwUIz7AmAR 6O6H8WhbyQXOJ26kuC2f+2avzgbGM473UqePeOq4+j5t2qM4vTayw6R2XhRCm6O8HTof AnO+pr8h6pXI81q3eLpZsbG5V65RvLUmnHpLQ6U20gZzk5fOo+c9uO0I+yMlXvYVF3je hDoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JT4ZjTHj; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l2-20020a1709067d4200b00722e55f1eccsi9581288ejp.198.2022.06.26.13.00.52; Sun, 26 Jun 2022 13:01:17 -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=@linaro.org header.s=google header.b=JT4ZjTHj; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229999AbiFZTte (ORCPT + 99 others); Sun, 26 Jun 2022 15:49:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229986AbiFZTtd (ORCPT ); Sun, 26 Jun 2022 15:49:33 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2D42196 for ; Sun, 26 Jun 2022 12:49:31 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id cf14so10324923edb.8 for ; Sun, 26 Jun 2022 12:49:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=cvc7WQjIfQALH8uF/wWzX8UFQ5EmdXg7iLe0SD89Mqo=; b=JT4ZjTHjXL+k64EtGK335t8/cXSx/wuAsDvOE7MSkpnLYT0urZJ1eaFKa5lIXEC8QW yPqCM8GfCtzkV/y5LV1cIda+oQQQbGv2doYMktzYGQ0LqFt0LUjIM1mc87yF5BUw5KWh myqB+Rp3cNocSG284jpQR/nGt6TTCsctUOU64mrAX6fuqguxM0MjUf0QmPqkeYGnp9Su ueXA1MD2cvnW63j76uv2i7/r5Cg8CxhsPUpaWBwGXBJeD6j/jubJv/Nu3yZN+70tD3dr 9ygms0KFNmomz0ulDXly4r3Ac+pzCiRylzXbueHsdA9B19kp3zeveA2nsB9ZOgLWjVGV 2Cbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=cvc7WQjIfQALH8uF/wWzX8UFQ5EmdXg7iLe0SD89Mqo=; b=ITGtpA/clcvOTGYtnuEJGs77RwHGBTJYJbtk9Ejs7zKWLeDzjDjDZ9LvhvFjXlnJTY 2khUv/6751P8cV996D6lc4vKzR34JP+BCeg23bzrSH2ababWckQvPplnNuPfA8/KNEsI rPPQXP0YXa9WtAWHgTyVhrKkNwULJyRhHvsIHYaddZguzfvKMAwZXPEr5RFmQqfyqgAi p8G6T5jojqP0esYulJ81Clcn+kkuxu1s6OsN41V/tucuoI24a40WiAW6gIvgGZeWXEiq B9sJIb50ddzOl2RR8htjzBmqWz/enuxNqsdcU8IELeYnamHoVX3kIJW3k/1euQDNnuv5 sL1w== X-Gm-Message-State: AJIora9l8s3mCmtkuosQuswAXvSl+Uy7vlCA2C4V74JZ2486799o1bjA jRIEVCsfrqyBsv8QjNh4muDJ1A== X-Received: by 2002:a05:6402:42d5:b0:433:1727:b31c with SMTP id i21-20020a05640242d500b004331727b31cmr12335712edc.9.1656272970265; Sun, 26 Jun 2022 12:49:30 -0700 (PDT) Received: from [192.168.0.244] (xdsl-188-155-176-92.adslplus.ch. [188.155.176.92]) by smtp.gmail.com with ESMTPSA id a12-20020a170906670c00b006fe8c831632sm4068087ejp.73.2022.06.26.12.49.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 Jun 2022 12:49:29 -0700 (PDT) Message-ID: <99e3ad4f-077a-0ca0-6842-b0c5a3439b68@linaro.org> Date: Sun, 26 Jun 2022 21:49:28 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH 1/2] NFC: nxp-nci: check return code of i2c_master_recv() Content-Language: en-US To: Michael Walle , Charles Gorand Cc: =?UTF-8?Q?Cl=c3=a9ment_Perrochaud?= , netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220626194243.4059870-1-michael@walle.cc> From: Krzysztof Kozlowski In-Reply-To: <20220626194243.4059870-1-michael@walle.cc> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, 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 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. > 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'. > + 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