linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Packham <Chris.Packham@alliedtelesis.co.nz>
To: Wolfram Sang <wsa@kernel.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"linux@roeck-us.net" <linux@roeck-us.net>,
	"jdelvare@suse.com" <jdelvare@suse.com>,
	"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 4/6] i2c: mpc: make interrupt mandatory and remove polling code
Date: Sun, 11 Apr 2021 23:57:07 +0000	[thread overview]
Message-ID: <2688f9c5-32ac-3df5-b0d1-063d443602b2@alliedtelesis.co.nz> (raw)
In-Reply-To: <20210410201646.GD2471@kunai>


On 11/04/21 8:16 am, Wolfram Sang wrote:
> On Mon, Mar 29, 2021 at 02:52:04PM +1300, Chris Packham wrote:
>> All the in-tree dts files that use one of the compatible strings from
>> i2c-mpc.c provide an interrupt property. By making this mandatory we
>> can simplify the code.
>>
>> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> After I applied this patch, cppcheck reports:
>
>      CPPCHECK
> drivers/i2c/busses/i2c-mpc.c:401:47: warning: Either the condition 'div?(int)div->fdr:-EINVAL' is redundant or there is possible null pointer dereference: div. [nullPointerRedundantCheck]
>   *real_clk = fsl_get_sys_freq() / prescaler / div->divider;
>                                                ^
> drivers/i2c/busses/i2c-mpc.c:402:13: note: Assuming that condition 'div?(int)div->fdr:-EINVAL' is not redundant
>   return div ? (int)div->fdr : -EINVAL;
>              ^
> drivers/i2c/busses/i2c-mpc.c:401:47: note: Null pointer dereference
>   *real_clk = fsl_get_sys_freq() / prescaler / div->divider;
>                                                ^
> Can you check this? I'd think we can fix it incrementally...
>
What are the arguments passed to cppcheck? I've tried two versions I 
have easy access to (1.82 and 1.86) neither report problems when invoked 
as `cppcheck drivers/i2c/busses/i2c-mpc.c` nor do they complain about 
this with `--enable=all`.

Looking at the code I can see what it's complaining about, div should 
have a value since mpc_i2c_dividers_8xxx does not have a sentinel value 
so I think the div check is unnecessary.

  reply	other threads:[~2021-04-11 23:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-29  1:52 [PATCH v2 0/6] i2c: mpc: Refactor to improve responsiveness Chris Packham
2021-03-29  1:52 ` [PATCH v2 1/6] dt-bindings: i2c-mpc: Document interrupt property as required Chris Packham
2021-03-30 15:13   ` Rob Herring
2021-03-29  1:52 ` [PATCH v2 2/6] dt-bindings: i2c: convert i2c-mpc to json-schema Chris Packham
2021-03-30 15:18   ` Rob Herring
2021-03-29  1:52 ` [PATCH v2 3/6] i2c: mpc: Make use of i2c_recover_bus() Chris Packham
2021-03-29  1:52 ` [PATCH v2 4/6] i2c: mpc: make interrupt mandatory and remove polling code Chris Packham
2021-04-10 20:16   ` Wolfram Sang
2021-04-11 23:57     ` Chris Packham [this message]
2021-03-29  1:52 ` [PATCH v2 5/6] i2c: mpc: use device managed APIs Chris Packham
2021-04-12 22:52   ` Andy Shevchenko
2021-04-12 22:55     ` Andy Shevchenko
2021-04-12 23:21     ` Chris Packham
2021-04-12 23:26       ` Chris Packham
2021-04-12 23:34       ` Andy Shevchenko
2021-03-29  1:52 ` [PATCH v2 6/6] i2c: mpc: Interrupt driven transfer Chris Packham
2021-04-10 20:13   ` Wolfram Sang
2021-04-11 21:31     ` Chris Packham
2021-04-12 18:17       ` Wolfram Sang
2021-04-12 22:57     ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2688f9c5-32ac-3df5-b0d1-063d443602b2@alliedtelesis.co.nz \
    --to=chris.packham@alliedtelesis.co.nz \
    --cc=devicetree@vger.kernel.org \
    --cc=jdelvare@suse.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=robh+dt@kernel.org \
    --cc=wsa@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).