lkml.org 
[lkml]   [2017]   [Feb]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH v5] staging: xgifb: correct the multiple line dereference
From
Date
On Tue, 2017-02-28 at 07:55 +0530, Arushi Singhal wrote:
> Error reported by checkpatch.pl as "avoid multiple line dereference".
> Addition of new variables to make the code more readable and also to
> correct about mentioned error as by itroducing new variables line is
> not exceeding 80 characters.
[]
> diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
[]
> @@ -221,8 +221,11 @@ static unsigned char XGI_AjustCRT2Rate(unsigned short ModeIdIndex,
>
> for (; XGI330_RefIndex[RefreshRateTableIndex + (*i)].ModeID ==
> tempbx; (*i)--) {
> - infoflag = XGI330_RefIndex[RefreshRateTableIndex + (*i)].
> - Ext_InfoFlag;
> + int j;
> +
> + j = XGI330_RefIndex[RefreshRateTableIndex + (*i)].Ext_InfoFlag;
> + infoflag = j;

Better would be to introduce a temporary like:

const struct XGI_Ext2Struct *ext2;

[code...]

ext2 = &XGI330_RefIndex[RefreshRateTableIndex];

and then index that like

for (; ext2[*i].ModeID == tempbx; (*i)--) {
infoflag = ext2[*i].Ext_InfoFlag;

> +
> if (infoflag & tempax)
> return 1;
>
> @@ -231,8 +234,11 @@ static unsigned char XGI_AjustCRT2Rate(unsigned short ModeIdIndex,
> }
>
> for ((*i) = 0;; (*i)++) {
> - infoflag = XGI330_RefIndex[RefreshRateTableIndex + (*i)].
> - Ext_InfoFlag;

etc...

\
 
 \ /
  Last update: 2017-02-28 07:12    [W:0.038 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site