All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	Jingoo Han <jg1.han@samsung.com>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Mauro Carvalho Chehab <m.chehab@samsung.com>,
	"Chen, Gong" <gong.chen@linux.intel.com>,
	linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] video: fbdev: sis: init.c:  Cleaning up redundant condition is always true
Date: Mon, 07 Jul 2014 07:57:09 +0000	[thread overview]
Message-ID: <20140707075709.GI25934@mwanda> (raw)
In-Reply-To: <1404422121-11298-1-git-send-email-rickard_strandqvist@spectrumdigital.se>

On Thu, Jul 03, 2014 at 11:15:21PM +0200, Rickard Strandqvist wrote:
> diff --git a/drivers/video/fbdev/sis/init.c b/drivers/video/fbdev/sis/init.c
> index bd40f5e..9e2dd96 100644
> --- a/drivers/video/fbdev/sis/init.c
> +++ b/drivers/video/fbdev/sis/init.c
> @@ -355,12 +355,12 @@ SiS_GetModeID(int VGAEngine, unsigned int VBFlags, int HDisplay, int VDisplay,
>  		}
>  		break;
>  	case 400:
> -		if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth >= 800) && (LCDwidth >= 600))) {
> +		if ((!(VBFlags & CRT1_LCDA)) || (LCDwidth >= 600)) {


It might be that this was supposed to be:

		if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth <= 800) && (LCDwidth >= 600))) {

But why would people write a range from high to low?  That's crazy
people who write backwards code...

The second condition was supposed to do *something* although it's
unclear what.  I would normally say that we should leave the static
checker warning here instead of guessing.  Perhaps add a comment like
/* fixme:  huh?  What's with this nonsense condition? */  But in this
case it's all dead code because LCDwidth is always zero and the code
hasn't changed since 2.6.12 so I don't care.

regards,
dan carpenter


WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	Jingoo Han <jg1.han@samsung.com>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Mauro Carvalho Chehab <m.chehab@samsung.com>,
	"Chen, Gong" <gong.chen@linux.intel.com>,
	linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] video: fbdev: sis: init.c:  Cleaning up redundant condition is always true
Date: Mon, 7 Jul 2014 10:57:09 +0300	[thread overview]
Message-ID: <20140707075709.GI25934@mwanda> (raw)
In-Reply-To: <1404422121-11298-1-git-send-email-rickard_strandqvist@spectrumdigital.se>

On Thu, Jul 03, 2014 at 11:15:21PM +0200, Rickard Strandqvist wrote:
> diff --git a/drivers/video/fbdev/sis/init.c b/drivers/video/fbdev/sis/init.c
> index bd40f5e..9e2dd96 100644
> --- a/drivers/video/fbdev/sis/init.c
> +++ b/drivers/video/fbdev/sis/init.c
> @@ -355,12 +355,12 @@ SiS_GetModeID(int VGAEngine, unsigned int VBFlags, int HDisplay, int VDisplay,
>  		}
>  		break;
>  	case 400:
> -		if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth >= 800) && (LCDwidth >= 600))) {
> +		if ((!(VBFlags & CRT1_LCDA)) || (LCDwidth >= 600)) {


It might be that this was supposed to be:

		if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth <= 800) && (LCDwidth >= 600))) {

But why would people write a range from high to low?  That's crazy
people who write backwards code...

The second condition was supposed to do *something* although it's
unclear what.  I would normally say that we should leave the static
checker warning here instead of guessing.  Perhaps add a comment like
/* fixme:  huh?  What's with this nonsense condition? */  But in this
case it's all dead code because LCDwidth is always zero and the code
hasn't changed since 2.6.12 so I don't care.

regards,
dan carpenter


  parent reply	other threads:[~2014-07-07  7:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-03 21:15 [PATCH] video: fbdev: sis: init.c: Cleaning up redundant condition is always true Rickard Strandqvist
2014-07-03 21:15 ` Rickard Strandqvist
2014-07-05 12:48 ` [PATCH] video: fbdev: sis: init.c: Cleaning up variable that is never used Rickard Strandqvist
2014-07-05 12:48   ` Rickard Strandqvist
2014-07-05 19:23   ` Dan Carpenter
2014-07-05 19:23     ` Dan Carpenter
2014-07-05 19:44     ` Geert Uytterhoeven
2014-07-05 19:44       ` Geert Uytterhoeven
2014-07-05 20:04       ` Dan Carpenter
2014-07-05 20:04         ` Dan Carpenter
2014-07-05 20:12         ` Dan Carpenter
2014-07-05 20:12           ` Dan Carpenter
2014-07-07  7:57 ` Dan Carpenter [this message]
2014-07-07  7:57   ` [PATCH] video: fbdev: sis: init.c: Cleaning up redundant condition is always true Dan Carpenter
2014-07-07  9:23   ` Noralf Tronnes
2014-07-07  9:23     ` Noralf Tronnes
2014-07-07 20:36     ` Rickard Strandqvist
2014-07-07 20:36       ` Rickard Strandqvist

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=20140707075709.GI25934@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=gong.chen@linux.intel.com \
    --cc=jg1.han@samsung.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    --cc=plagnioj@jcrosoft.com \
    --cc=rickard_strandqvist@spectrumdigital.se \
    --cc=tomi.valkeinen@ti.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.