video: fbdev: sis: Fix set but not used warnings in init.c

Colin Ian King colin.king at canonical.com
Tue Dec 1 12:24:37 UTC 2020


Hi,

Static analysis on linux-next with Coverity had detected a minor issue
in the following commit:

commit 2a74e8682a39d00e04ca278459ae7d7ecbdfb394
Author: Sam Ravnborg <sam at ravnborg.org>
Date:   Sat Nov 28 23:40:55 2020 +0100

    video: fbdev: sis: Fix set but not used warnings in init.c


The analysis is as follows:

2659   if(SiS_Pr->UseCustomMode) {
2660      infoflag = SiS_Pr->CInfoFlag;
2661   } else {

Useless call (USELESS_CALL) side_effect_free: Calling
 SiS_GetResInfo(SiS_Pr, ModeNo, ModeIdIndex) is only useful for its
return value, which is ignored.

2662      SiS_GetResInfo(SiS_Pr, ModeNo, ModeIdIndex);
2663      if(ModeNo > 0x13) {
2664         infoflag = SiS_Pr->SiS_RefIndex[RRTI].Ext_InfoFlag;
2665      }
2666   }

.. SiSGetResInfo() just returns an unsigned short and this returns a
values is not being used. The function does not side effect anything, so
it does look like a redundant call. Is this intentional?

3044 unsigned short
3045 SiS_GetResInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
unsigned short ModeIdIndex)
3046 {
3047   if(ModeNo <= 0x13)
3048      return ((unsigned
short)SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo);
3049   else
3050      return ((unsigned
short)SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO);
3051 }

Colin


More information about the dri-devel mailing list