Skip to content

Commit 23413fe

Browse files
cris1618gregkh
authored andcommitted
staging: sm750fb: avoid chained assignment in setcolreg()
Replace the chained assignment of red/green/blue with a temporary variable and braces. This keeps behavior identical while improving readability and satisfying checkpatch. No functional change intended. Signed-off-by: Cristian Del Gobbo <cristiandelgobbo87@gmail.com> Link: https://patch.msgid.link/20251102230139.1720-2-cristiandelgobbo87@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3a3fd27 commit 23413fe

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

drivers/staging/sm750fb/sm750.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,13 @@ static int lynxfb_ops_setcolreg(unsigned int regno,
537537
return -EINVAL;
538538
}
539539

540-
if (info->var.grayscale)
541-
red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8;
540+
if (info->var.grayscale) {
541+
int lum = (red * 77 + green * 151 + blue * 28) >> 8;
542+
543+
red = lum;
544+
green = lum;
545+
blue = lum;
546+
}
542547

543548
if (var->bits_per_pixel == 8 &&
544549
info->fix.visual == FB_VISUAL_PSEUDOCOLOR) {

0 commit comments

Comments
 (0)