Messages in this thread Patch in this message | | | Subject | Re: [PATCH v5] staging: xgifb: correct the multiple line dereference | From | Joe Perches <> | Date | Mon, 27 Feb 2017 22:11:45 -0800 |
| |
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...
| |