Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3176255ybz; Mon, 27 Apr 2020 11:19:20 -0700 (PDT) X-Google-Smtp-Source: APiQypI6mR7xpskI450HV/nbzcmtQAA1r4hMsWAxaLvaIsQz5iRyC9JTN3lGC5QJaB3E4kpAQOLk X-Received: by 2002:aa7:cdcb:: with SMTP id h11mr18696468edw.264.1588011560423; Mon, 27 Apr 2020 11:19:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588011560; cv=none; d=google.com; s=arc-20160816; b=bg5Rysqpu2EFuSokC56G2ET+SQlzU2F+XjWZgwwu9mAYG+kIrfhPcTO4/dHZsdt9qM IiodRoRX2xwGh/C7pRVqhSw6Y5E3hSXIkzO4CeJex4NVFfTW3AW7auvszY4J36IeqmNp Ny3hiZ/PwqiJkrua0xaUVv4mX2k9N5ruoAFez+pWWbI64RallMnK9pz2BGrrw4wGdmjK R9Oy46+S8bbX1dadzWlGk5HHTUd8mB9qbkljcB0aDELo8+NrmWHC8y3C7lDL15sEL8oZ rK5FUrBpZHnj8Pj4oWuROcn7NX+8e8hjS8r9UkRd15vklxt8m4EGOp4PoykpTZKCk9tB WnzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=cmLQU8rm1MaDWTn/mChW2COr9I5pa8fmPALHO00ydSY=; b=gXDKGHGU1xmbRrJyph5Ym3y+0vqFJXP2n1Oh5Wfc6kVXBXnBzuZfvda2MsbnvpJLT/ zUcbTpX+1Iou0CnhdPMW+3Yt1UsCTfCSEhE8AdQDqbtjiAdIzLLg7+lEy67N5QdsPF7k ADFwiuMKBRgd+iPvpCUGuxHR+M6T9L4aF8W3Ah8lyKwdZks4q9HY2F5EsxAbwZO50JIT cBu87rCoLSsnRdBKek/Uc2opAGYT+FxfP/eFLMmSUWhgcIdIriXGDW5YobRlYRWP+VFV ByvUWqYOFRD8Oq3gZ4elhe5LPgztSWTjK9HMJJYX1Ttv/QF7hbwZzFqWB/7I378MkeEq 1qow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OS71vo6P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d24si197415edv.539.2020.04.27.11.18.55; Mon, 27 Apr 2020 11:19:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OS71vo6P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726519AbgD0SQH (ORCPT + 99 others); Mon, 27 Apr 2020 14:16:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726228AbgD0SQH (ORCPT ); Mon, 27 Apr 2020 14:16:07 -0400 Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EC49C0610D5; Mon, 27 Apr 2020 11:16:07 -0700 (PDT) Received: by mail-il1-x143.google.com with SMTP id x2so17647679ilp.13; Mon, 27 Apr 2020 11:16:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cmLQU8rm1MaDWTn/mChW2COr9I5pa8fmPALHO00ydSY=; b=OS71vo6P5vRGR7AIQ9CH2o0GTvUWbKTixJVTcs8LBpJy78MN68wS+w1L/NE2W7QQ0A aT7sxCcpIFOPqcZDHmn7H+jdLo9NrBNf7E8pdvxvhTEORZeDHUbNdFnjyXc/NckLS8U0 Fcyz8/Jm9yBAsfkM0QSWqYbYadsnwxVb9kzDFpCuUg1pOYe7FDMmxxwNJPsMOlPpYllr 4KBARKthF33uAlP1AcLoagxMY1RvIEdLoTW7UUzvR7F1yVQJqv1GEn+6aDTNmjYcwxn0 76w/tx7QqpRKlJ7VFipVo9CMKljrrDXIoVcx/+OqNjWFl9LWUWII2yr06aDbQ5Pu6L/U uPsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cmLQU8rm1MaDWTn/mChW2COr9I5pa8fmPALHO00ydSY=; b=egZ6Lw6YujGwfgdau/RnCrP0WjwoNGDmrtbmAUOO4wwctpIJY49wRkc/rg6zraEGpU 1lgJDHFCT/kzLyM/LjLWqCslMPT78XNv0s9Fmv4mPVeEuUJfTLys+tJFkXHvzlu6GAhF HZ6gRNhWq/qhs4/CZOat6DSBfypHrxy5JgsPgv9GEXNfadzNs6HnQlOygF3HAMGI15op m8C3bSdpv5HUQlX2SsSp1iwuZGMxX8OX/SF5l88hKDaoSaSzN4be7b3V0opI5Br5khYX uzH9u+Elda8lQvOYofeNk2Gpr7hiCBuPgHJHbSNjFvHhw+/V32sC4SjVEElQScyR05Qw t6ww== X-Gm-Message-State: AGi0Pua8zxMyUKCNeA9mE9IgCGtzZKj72QCyW/SvOUXVa3lxSs2/8ggy t94814Zan1YFriPLDZQXVIcPMd487ygs3Fboc/J9p1fK X-Received: by 2002:a92:d846:: with SMTP id h6mr19975276ilq.248.1588011366489; Mon, 27 Apr 2020 11:16:06 -0700 (PDT) MIME-Version: 1.0 References: <20200426081211.10876-1-wsa+renesas@sang-engineering.com> In-Reply-To: <20200426081211.10876-1-wsa+renesas@sang-engineering.com> From: Kamal Dasu Date: Mon, 27 Apr 2020 14:15:54 -0400 Message-ID: Subject: Re: [PATCH RFT] i2c: brcmstb: properly check NACK condition To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, Stefan Wahren , Wolfram Sang , Florian Fainelli , bcm-kernel-feedback-list , linux-arm-kernel@lists.infradead.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 26, 2020 at 4:12 AM Wolfram Sang wrote: > > From: Wolfram Sang > > cppcheck rightfully complains about: > > drivers/i2c/busses/i2c-brcmstb.c:319:7: warning: Condition 'CMD_RD' is always true [knownConditionTrueFalse] > drivers/i2c/busses/i2c-brcmstb.c:319:17: warning: Condition 'CMD_WR' is always false [knownConditionTrueFalse] > if ((CMD_RD || CMD_WR) && > > Compare the values to the 'cmd' variable. > > Fixes: dd1aa2524bc5 ("i2c: brcmstb: Add Broadcom settop SoC i2c controller driver") > Signed-off-by: Wolfram Sang Reviewed-by: Kamal Dasu --- > > Not tested on HW. > > drivers/i2c/busses/i2c-brcmstb.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/i2c/busses/i2c-brcmstb.c b/drivers/i2c/busses/i2c-brcmstb.c > index d4e0a0f6732a..ba766d24219e 100644 > --- a/drivers/i2c/busses/i2c-brcmstb.c > +++ b/drivers/i2c/busses/i2c-brcmstb.c > @@ -316,7 +316,7 @@ static int brcmstb_send_i2c_cmd(struct brcmstb_i2c_dev *dev, > goto cmd_out; > } > > - if ((CMD_RD || CMD_WR) && > + if ((cmd == CMD_RD || cmd == CMD_WR) && > bsc_readl(dev, iic_enable) & BSC_IIC_EN_NOACK_MASK) { > rc = -EREMOTEIO; > dev_dbg(dev->device, "controller received NOACK intr for %s\n", > -- > 2.20.1 >