public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* linux-4.7-rc2/drivers/rtc/rtc-ds1685.c: 2 * bad if test ?
@ 2016-06-07 15:18 David Binderman
  2016-06-07 15:30 ` Alexandre Belloni
  0 siblings, 1 reply; 3+ messages in thread
From: David Binderman @ 2016-06-07 15:18 UTC (permalink / raw)
  To: kumba, a.zummo, alexandre.belloni, rtc-linux, linux-kernel,
	dcb314

Hello there,

1.

linux-4.7-rc2/drivers/rtc/rtc-ds1685.c:392]: (style) Redundant
condition: If '!(mday >= 1)', the comparison 'mday <= 31' is always
true.

Source code is

   if (!(mday >= 1) && (mday <= 31))

Maybe better code

   if (!((mday >= 1) && (mday <= 31)))

2.

linux-4.7-rc2/drivers/rtc/rtc-ds1685.c:464]: (style) Redundant
condition: If '!(mday >= 1)', the comparison 'mday <= 31' is always
true.

Duplicate. Also in the same file:

[drivers/rtc/rtc-ds1685.c:265]: (style) Variable 'ctrlb' is assigned a
value that is never used.
[drivers/rtc/rtc-ds1685.c:812]: (style) Variable 'ctrlc' is assigned a
value that is never used.


Regards

David Binderman

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: linux-4.7-rc2/drivers/rtc/rtc-ds1685.c: 2 * bad if test ?
  2016-06-07 15:18 linux-4.7-rc2/drivers/rtc/rtc-ds1685.c: 2 * bad if test ? David Binderman
@ 2016-06-07 15:30 ` Alexandre Belloni
  2016-06-07 22:12   ` Joshua Kinard
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Belloni @ 2016-06-07 15:30 UTC (permalink / raw)
  To: David Binderman; +Cc: kumba, a.zummo, rtc-linux, linux-kernel, dcb314

Hi,

On 07/06/2016 at 16:18:31 +0100, David Binderman wrote :
> Hello there,
> 
> 1.
> 
> linux-4.7-rc2/drivers/rtc/rtc-ds1685.c:392]: (style) Redundant
> condition: If '!(mday >= 1)', the comparison 'mday <= 31' is always
> true.
> 
> Source code is
> 
>    if (!(mday >= 1) && (mday <= 31))
> 
> Maybe better code
> 
>    if (!((mday >= 1) && (mday <= 31)))
> 
> 2.
> 
> linux-4.7-rc2/drivers/rtc/rtc-ds1685.c:464]: (style) Redundant
> condition: If '!(mday >= 1)', the comparison 'mday <= 31' is always
> true.
> 

See
http://git.kernel.org/cgit/linux/kernel/git/abelloni/linux.git/commit/?h=rtc-next&id=c5776dec8f2a90a0aa9e197c2900f68fda8dd978

This should fix that issue.

> Duplicate. Also in the same file:
> 
> [drivers/rtc/rtc-ds1685.c:265]: (style) Variable 'ctrlb' is assigned a
> value that is never used.
> [drivers/rtc/rtc-ds1685.c:812]: (style) Variable 'ctrlc' is assigned a
> value that is never used.
> 

Well, feel free to send a patch. Please include the name of the tool you
used to find that as I pretty much prefer changes that are tested over
cleanup form static analysis tools.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: linux-4.7-rc2/drivers/rtc/rtc-ds1685.c: 2 * bad if test ?
  2016-06-07 15:30 ` Alexandre Belloni
@ 2016-06-07 22:12   ` Joshua Kinard
  0 siblings, 0 replies; 3+ messages in thread
From: Joshua Kinard @ 2016-06-07 22:12 UTC (permalink / raw)
  To: Alexandre Belloni, David Binderman
  Cc: a.zummo, rtc-linux, linux-kernel, dcb314

On 06/07/2016 11:30, Alexandre Belloni wrote:
> Hi,
> 
> On 07/06/2016 at 16:18:31 +0100, David Binderman wrote :
>> Hello there,
>>

[snip]

>> Duplicate. Also in the same file:
>>
>> [drivers/rtc/rtc-ds1685.c:265]: (style) Variable 'ctrlb' is assigned a
>> value that is never used.

This looks like it can be removed.  I believe it's a relic of before I added
the handling of either BCD or Binary modes for the SGI Octane's RTC interface.


>> [drivers/rtc/rtc-ds1685.c:812]: (style) Variable 'ctrlc' is assigned a
>> value that is never used.

This needs to be wrapped in #ifdef CONFIG_RTC_DS1685_PROC_REGS, as the value of
'ctrlc' is displayed in /proc/drivers/rtc if that kconfig option is selected on
supported systems.



-- 
Joshua Kinard
Gentoo/MIPS
kumba@gentoo.org
6144R/F5C6C943 2015-04-27
177C 1972 1FB8 F254 BAD0 3E72 5C63 F4E3 F5C6 C943

"The past tempts us, the present confuses us, the future frightens us.  And our
lives slip away, moment by moment, lost in that vast, terrible in-between."

--Emperor Turhan, Centauri Republic

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-06-07 22:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-07 15:18 linux-4.7-rc2/drivers/rtc/rtc-ds1685.c: 2 * bad if test ? David Binderman
2016-06-07 15:30 ` Alexandre Belloni
2016-06-07 22:12   ` Joshua Kinard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox