[bug report] drm: panel: Add driver for Himax HX8279 DDIC panels
Dan Carpenter
dan.carpenter at linaro.org
Wed Apr 23 06:29:21 UTC 2025
Hello AngeloGioacchino Del Regno,
Commit 38d42c261389 ("drm: panel: Add driver for Himax HX8279 DDIC
panels") from Apr 14, 2025 (linux-next), leads to the following
Smatch static checker warning:
drivers/gpu/drm/panel/panel-himax-hx8279.c:593 hx8279_set_digital_gamma()
warn: reusing outside iterator: 'i'
drivers/gpu/drm/panel/panel-himax-hx8279.c
573 static void hx8279_set_digital_gamma(struct hx8279 *hx,
574 struct mipi_dsi_multi_context *dsi_ctx)
575 {
576 const struct hx8279_digital_gamma *dgamma = hx->desc->dgamma;
577 u8 cmd_set_dig_gamma[2];
578 int i;
579
580 if (!dgamma)
581 return;
582
583 /*
584 * Pages 7..9 are for RGB Positive, 10..12 are for RGB Negative:
585 * The first iteration sets all positive component registers,
586 * the second one sets all negatives.
587 */
588 for (i = 0; i < 2; i++) {
^^^^^^^^^^^^^^^^^
This looks like a loop but it only iterates once
589 u8 pg_neg = i * 3;
590
591 hx8279_set_page(hx, dsi_ctx, 7 + pg_neg);
592
--> 593 for (i = 0; i < ARRAY_SIZE(dgamma->r); i++) {
because we re-use i here
594 cmd_set_dig_gamma[0] = HX8279_PG_DIGITAL_GAMMA + i;
595 cmd_set_dig_gamma[1] = dgamma->r[i];
596 mipi_dsi_generic_write_multi(dsi_ctx, cmd_set_dig_gamma,
597 ARRAY_SIZE(cmd_set_dig_gamma));
598 }
599
600 hx8279_set_page(hx, dsi_ctx, 8 + pg_neg);
601
602 for (i = 0; i < ARRAY_SIZE(dgamma->g); i++) {
and here
603 cmd_set_dig_gamma[0] = HX8279_PG_DIGITAL_GAMMA + i;
604 cmd_set_dig_gamma[1] = dgamma->g[i];
605 mipi_dsi_generic_write_multi(dsi_ctx, cmd_set_dig_gamma,
606 ARRAY_SIZE(cmd_set_dig_gamma));
607 }
608
609 hx8279_set_page(hx, dsi_ctx, 9 + pg_neg);
610
611 for (i = 0; i < ARRAY_SIZE(dgamma->b); i++) {
and here
612 cmd_set_dig_gamma[0] = HX8279_PG_DIGITAL_GAMMA + i;
613 cmd_set_dig_gamma[1] = dgamma->b[i];
614 mipi_dsi_generic_write_multi(dsi_ctx, cmd_set_dig_gamma,
615 ARRAY_SIZE(cmd_set_dig_gamma));
616 }
617 }
618 }
regards,
dan carpenter
More information about the dri-devel
mailing list