* [PATCH] video: fbdev: sis: init.c: Cleaning up redundant condition is always true @ 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-07 7:57 ` [PATCH] video: fbdev: sis: init.c: Cleaning up redundant condition is always true Dan Carpenter 0 siblings, 2 replies; 9+ messages in thread From: Rickard Strandqvist @ 2014-07-03 21:15 UTC (permalink / raw) To: Jean-Christophe Plagniol-Villard, Tomi Valkeinen Cc: Rickard Strandqvist, Jingoo Han, Daniel Vetter, Mauro Carvalho Chehab, Chen, Gong, Dan Carpenter, linux-fbdev, linux-kernel Removal of a redundant condition that is always true This was found using a static code analysis program called cppcheck Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> --- drivers/video/fbdev/sis/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)) { if(VDisplay = 300) ModeIndex = ModeIndex_400x300[Depth]; } break; case 512: - if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth >= 1024) && (LCDwidth >= 768))) { + if ((!(VBFlags & CRT1_LCDA)) || (LCDwidth >= 768)) { if(VDisplay = 384) ModeIndex = ModeIndex_512x384[Depth]; } break; -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH] video: fbdev: sis: init.c: Cleaning up variable that is never used 2014-07-03 21:15 [PATCH] video: fbdev: sis: init.c: Cleaning up redundant condition is always true Rickard Strandqvist @ 2014-07-05 12:48 ` Rickard Strandqvist 2014-07-05 19:23 ` Dan Carpenter 2014-07-07 7:57 ` [PATCH] video: fbdev: sis: init.c: Cleaning up redundant condition is always true Dan Carpenter 1 sibling, 1 reply; 9+ messages in thread From: Rickard Strandqvist @ 2014-07-05 12:48 UTC (permalink / raw) To: Jean-Christophe Plagniol-Villard, Tomi Valkeinen Cc: Rickard Strandqvist, Rickard Strandqvist, Jingoo Han, Daniel Vetter, Mauro Carvalho Chehab, Laurent Pinchart, Chen, Gong, Dan Carpenter, linux-fbdev, linux-kernel From: Rickard Strandqvist <rickard.strandqvist@sonymobile.com> Variable ar assigned a value that is never used. I have also removed all the code that thereby serves no purpose. This was found using a static code analysis program called cppcheck Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> --- drivers/video/fbdev/sis/init.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/drivers/video/fbdev/sis/init.c b/drivers/video/fbdev/sis/init.c index bd40f5e..3ba446c 100644 --- a/drivers/video/fbdev/sis/init.c +++ b/drivers/video/fbdev/sis/init.c @@ -2649,7 +2649,7 @@ static void SiS_SetCRT1ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RRTI) { - unsigned short data, infoflag = 0, modeflag, resindex; + unsigned short data, infoflag = 0, modeflag; #ifdef CONFIG_FB_SIS_315 unsigned char *ROMAddr = SiS_Pr->VirtualRomBase; unsigned short data2, data3; @@ -2660,7 +2660,7 @@ SiS_SetCRT1ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo, if(SiS_Pr->UseCustomMode) { infoflag = SiS_Pr->CInfoFlag; } else { - resindex = SiS_GetResInfo(SiS_Pr, ModeNo, ModeIdIndex); + SiS_GetResInfo(SiS_Pr, ModeNo, ModeIdIndex); if(ModeNo > 0x13) { infoflag = SiS_Pr->SiS_RefIndex[RRTI].Ext_InfoFlag; } @@ -3539,16 +3539,15 @@ SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata, struct fb_var_screeninfo *var, bool writeres ) { - unsigned short HRE, HBE, HRS, HBS, HDE, HT; - unsigned short VRE, VBE, VRS, VBS, VDE, VT; + unsigned short HRE, HBE, HRS, HDE, HT; + unsigned short VRE, VBE, VRS, VDE, VT; unsigned char sr_data, cr_data, cr_data2; - int A, B, C, D, E, F, temp; + int B, C, D, E, F, temp; sr_data = crdata[14]; /* Horizontal total */ HT = crdata[0] | ((unsigned short)(sr_data & 0x03) << 8); - A = HT + 5; /* Horizontal display enable end */ HDE = crdata[1] | ((unsigned short)(sr_data & 0x0C) << 6); @@ -3558,9 +3557,6 @@ SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata, HRS = crdata[4] | ((unsigned short)(sr_data & 0xC0) << 2); F = HRS - E - 3; - /* Horizontal blank start */ - HBS = crdata[2] | ((unsigned short)(sr_data & 0x30) << 4); - sr_data = crdata[15]; cr_data = crdata[5]; @@ -3594,7 +3590,6 @@ SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata, ((unsigned short)(cr_data & 0x01) << 8) | ((unsigned short)(cr_data & 0x20) << 4) | ((unsigned short)(sr_data & 0x01) << 10); - A = VT + 2; /* Vertical display enable end */ VDE = crdata[10] | @@ -3612,12 +3607,6 @@ SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata, cr_data2 = (crdata[16] & 0x01) << 5; - /* Vertical blank start */ - VBS = crdata[11] | - ((unsigned short)(cr_data & 0x08) << 5) | - ((unsigned short)(cr_data2 & 0x20) << 4) | - ((unsigned short)(sr_data & 0x04) << 8); - /* Vertical blank end */ VBE = crdata[12] | ((unsigned short)(sr_data & 0x10) << 4); temp = VBE - ((E - 1) & 511); -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] video: fbdev: sis: init.c: Cleaning up variable that is never used 2014-07-05 12:48 ` [PATCH] video: fbdev: sis: init.c: Cleaning up variable that is never used Rickard Strandqvist @ 2014-07-05 19:23 ` Dan Carpenter 2014-07-05 19:44 ` Geert Uytterhoeven 0 siblings, 1 reply; 9+ messages in thread From: Dan Carpenter @ 2014-07-05 19:23 UTC (permalink / raw) To: Rickard Strandqvist Cc: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, Rickard Strandqvist, Jingoo Han, Daniel Vetter, Mauro Carvalho Chehab, Laurent Pinchart, Chen, Gong, linux-fbdev, linux-kernel On Sat, Jul 05, 2014 at 02:48:27PM +0200, Rickard Strandqvist wrote: > From: Rickard Strandqvist <rickard.strandqvist@sonymobile.com> These for lines are for when you are sending on someone else's behalf. > > Variable ar assigned a value that is never used. > I have also removed all the code that thereby serves no purpose. > > This was found using a static code analysis program called cppcheck > > Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> > --- > drivers/video/fbdev/sis/init.c | 21 +++++---------------- > 1 file changed, 5 insertions(+), 16 deletions(-) > > diff --git a/drivers/video/fbdev/sis/init.c b/drivers/video/fbdev/sis/init.c > index bd40f5e..3ba446c 100644 > --- a/drivers/video/fbdev/sis/init.c > +++ b/drivers/video/fbdev/sis/init.c > @@ -2649,7 +2649,7 @@ static void > SiS_SetCRT1ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo, > unsigned short ModeIdIndex, unsigned short RRTI) > { > - unsigned short data, infoflag = 0, modeflag, resindex; > + unsigned short data, infoflag = 0, modeflag; > #ifdef CONFIG_FB_SIS_315 > unsigned char *ROMAddr = SiS_Pr->VirtualRomBase; > unsigned short data2, data3; > @@ -2660,7 +2660,7 @@ SiS_SetCRT1ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo, > if(SiS_Pr->UseCustomMode) { > infoflag = SiS_Pr->CInfoFlag; > } else { > - resindex = SiS_GetResInfo(SiS_Pr, ModeNo, ModeIdIndex); > + SiS_GetResInfo(SiS_Pr, ModeNo, ModeIdIndex); Remove this whole line. regards, dan carpenter ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] video: fbdev: sis: init.c: Cleaning up variable that is never used 2014-07-05 19:23 ` Dan Carpenter @ 2014-07-05 19:44 ` Geert Uytterhoeven 2014-07-05 20:04 ` Dan Carpenter 0 siblings, 1 reply; 9+ messages in thread From: Geert Uytterhoeven @ 2014-07-05 19:44 UTC (permalink / raw) To: Dan Carpenter Cc: Rickard Strandqvist, Jean-Christophe Plagniol-Villard, Tomi Valkeinen, Rickard Strandqvist, Jingoo Han, Daniel Vetter, Mauro Carvalho Chehab, Laurent Pinchart, Chen, Gong, Linux Fbdev development list, linux-kernel@vger.kernel.org On Sat, Jul 5, 2014 at 9:23 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote: > On Sat, Jul 05, 2014 at 02:48:27PM +0200, Rickard Strandqvist wrote: >> From: Rickard Strandqvist <rickard.strandqvist@sonymobile.com> > > These for lines are for when you are sending on someone else's behalf. Or for when you are sending the patches from a different email address than the one that should be recorded in git. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] video: fbdev: sis: init.c: Cleaning up variable that is never used 2014-07-05 19:44 ` Geert Uytterhoeven @ 2014-07-05 20:04 ` Dan Carpenter 2014-07-05 20:12 ` Dan Carpenter 0 siblings, 1 reply; 9+ messages in thread From: Dan Carpenter @ 2014-07-05 20:04 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Rickard Strandqvist, Jean-Christophe Plagniol-Villard, Tomi Valkeinen, Rickard Strandqvist, Jingoo Han, Daniel Vetter, Mauro Carvalho Chehab, Laurent Pinchart, Chen, Gong, Linux Fbdev development list, linux-kernel@vger.kernel.org On Sat, Jul 05, 2014 at 09:44:56PM +0200, Geert Uytterhoeven wrote: > On Sat, Jul 5, 2014 at 9:23 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote: > > On Sat, Jul 05, 2014 at 02:48:27PM +0200, Rickard Strandqvist wrote: > >> From: Rickard Strandqvist <rickard.strandqvist@sonymobile.com> > > > > These for lines are for when you are sending on someone else's behalf. > > Or for when you are sending the patches from a different email address > than the one that should be recorded in git. > Yeah. But it's better to fix your email client so we can at least verify that the signed off matches the author tag. I know a lot of people have trouble configuring email but in the end everyone pretty much manages when we ask them to. regards, dan carpenter ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] video: fbdev: sis: init.c: Cleaning up variable that is never used 2014-07-05 20:04 ` Dan Carpenter @ 2014-07-05 20:12 ` Dan Carpenter 0 siblings, 0 replies; 9+ messages in thread From: Dan Carpenter @ 2014-07-05 20:12 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Rickard Strandqvist, Jean-Christophe Plagniol-Villard, Tomi Valkeinen, Rickard Strandqvist, Jingoo Han, Daniel Vetter, Mauro Carvalho Chehab, Laurent Pinchart, Chen, Gong, Linux Fbdev development list, linux-kernel@vger.kernel.org Verifying the email address is not 100% fool proof so it's not a massive deal either way. The only reason I mentioned it here was because this patch wasn't correct anyway and had to be redone regardless. regards, dan carpenter ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] video: fbdev: sis: init.c: Cleaning up redundant condition is always true 2014-07-03 21:15 [PATCH] video: fbdev: sis: init.c: Cleaning up redundant condition is always true Rickard Strandqvist 2014-07-05 12:48 ` [PATCH] video: fbdev: sis: init.c: Cleaning up variable that is never used Rickard Strandqvist @ 2014-07-07 7:57 ` Dan Carpenter 2014-07-07 9:23 ` Noralf Tronnes 1 sibling, 1 reply; 9+ messages in thread From: Dan Carpenter @ 2014-07-07 7:57 UTC (permalink / raw) To: Rickard Strandqvist Cc: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, Jingoo Han, Daniel Vetter, Mauro Carvalho Chehab, Chen, Gong, linux-fbdev, linux-kernel 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] video: fbdev: sis: init.c: Cleaning up redundant condition is always true 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 20:36 ` Rickard Strandqvist 0 siblings, 1 reply; 9+ messages in thread From: Noralf Tronnes @ 2014-07-07 9:23 UTC (permalink / raw) To: Dan Carpenter, Rickard Strandqvist Cc: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, Jingoo Han, Daniel Vetter, Mauro Carvalho Chehab, Chen, Gong, linux-fbdev, linux-kernel Den 07.07.2014 09:57, skrev Dan Carpenter: > 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 numbers 800x600 (1024x768) indicate that LCDheight is meant to be used: if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth >= 800) && (LCDheight >= 600))) { regards, Noralf Tronnes ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] video: fbdev: sis: init.c: Cleaning up redundant condition is always true 2014-07-07 9:23 ` Noralf Tronnes @ 2014-07-07 20:36 ` Rickard Strandqvist 0 siblings, 0 replies; 9+ messages in thread From: Rickard Strandqvist @ 2014-07-07 20:36 UTC (permalink / raw) To: Noralf Tronnes Cc: Dan Carpenter, Jean-Christophe Plagniol-Villard, Tomi Valkeinen, Jingoo Han, Daniel Vetter, Mauro Carvalho Chehab, Chen, Gong, Linux Fbdev development list, linux-kernel@vger.kernel.org 2014-07-07 11:23 GMT+02:00 Noralf Tronnes <notro@tronnes.org>: > Den 07.07.2014 09:57, skrev Dan Carpenter: > >> 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 numbers 800x600 (1024x768) indicate that LCDheight is meant to be used: > if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth >= 800) && > (LCDheight >= 600))) { > > regards, > Noralf Tronnes Hi Nice, this is what is the point of fix this type of minor errors. Sometimes you can find something more serious :) New patch on the way! Kind regards Rickard Strandqvist ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-07-07 20:36 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-07-03 21:15 [PATCH] video: fbdev: sis: init.c: Cleaning up redundant condition is always true 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 19:23 ` Dan Carpenter 2014-07-05 19:44 ` Geert Uytterhoeven 2014-07-05 20:04 ` Dan Carpenter 2014-07-05 20:12 ` Dan Carpenter 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 20:36 ` Rickard Strandqvist
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).