Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1589199
| From | Joe Perches <joe@perches.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v5] staging: xgifb: correct the multiple line dereference |
| Date | 2017-02-28 07:20 +0100 |
| Message-ID | <tfJiF-uX-5@gated-at.bofh.it> (permalink) |
| References | <tfHJT-7FS-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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...
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v5] staging: xgifb: correct the multiple line dereference Arushi Singhal <arushisinghal19971997@gmail.com> - 2017-02-28 05:40 +0100 Re: [PATCH v5] staging: xgifb: correct the multiple line dereference Joe Perches <joe@perches.com> - 2017-02-28 07:20 +0100
csiph-web