Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Cristian Del Gobbo and committed by
Greg Kroah-Hartman
23413fe1 3a3fd27e

+7 -2
+7 -2
drivers/staging/sm750fb/sm750.c
··· 537 537 return -EINVAL; 538 538 } 539 539 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 + } 542 547 543 548 if (var->bits_per_pixel == 8 && 544 549 info->fix.visual == FB_VISUAL_PSEUDOCOLOR) {