[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2688f9c5-32ac-3df5-b0d1-063d443602b2@alliedtelesis.co.nz>
Date: Sun, 11 Apr 2021 23:57:07 +0000
From: Chris Packham <Chris.Packham@...iedtelesis.co.nz>
To: Wolfram Sang <wsa@...nel.org>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"linux@...ck-us.net" <linux@...ck-us.net>,
"jdelvare@...e.com" <jdelvare@...e.com>,
"linux-i2c@...r.kernel.org" <linux-i2c@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 4/6] i2c: mpc: make interrupt mandatory and remove
polling code
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@...iedtelesis.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.
Powered by blists - more mailing lists