OMAPDSS: remove compiler warnings when CONFIG_BUG=n
If CONFIG_BUG is not enabled, BUG() does not stop the execution. Many
places in code expect the execution to stop, and this causes compiler
warnings about uninitialized variables and returning from a non-void
function without a return value.
This patch fixes the warnings by initializing the variables and
returning properly after BUG() lines. However, the behaviour is still
undefined after the BUG, but this is the choice the user makes when
using CONFIG_BUG=n.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 0fa1c94..3d0576d 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -407,6 +407,7 @@
return DISPC_IRQ_EVSYNC_ODD | DISPC_IRQ_EVSYNC_EVEN;
default:
BUG();
+ return 0;
}
}
@@ -421,6 +422,7 @@
return 0;
default:
BUG();
+ return 0;
}
}
@@ -739,7 +741,7 @@
case OMAP_DSS_COLOR_XRGB16_1555:
m = 0xf; break;
default:
- BUG(); break;
+ BUG(); return;
}
} else {
switch (color_mode) {
@@ -776,7 +778,7 @@
case OMAP_DSS_COLOR_XRGB16_1555:
m = 0xf; break;
default:
- BUG(); break;
+ BUG(); return;
}
}
@@ -820,6 +822,7 @@
break;
default:
BUG();
+ return;
}
val = FLD_MOD(val, chan, shift, shift);
@@ -847,6 +850,7 @@
break;
default:
BUG();
+ return 0;
}
val = dispc_read_reg(DISPC_OVL_ATTRIBUTES(plane));
@@ -1209,6 +1213,7 @@
break;
default:
BUG();
+ return;
}
switch (color_mode) {
@@ -1224,6 +1229,7 @@
break;
default:
BUG();
+ return;
}
accu_val = &accu_table[idx];
@@ -1339,6 +1345,7 @@
break;
default:
BUG();
+ return;
}
if (out_width != orig_width)
@@ -1466,6 +1473,7 @@
return 32;
default:
BUG();
+ return 0;
}
}
@@ -1479,6 +1487,7 @@
return 1 - (-pixels + 1) * ps;
else
BUG();
+ return 0;
}
static void calc_vrfb_rotation_offset(u8 rotation, bool mirror,
@@ -1562,6 +1571,7 @@
default:
BUG();
+ return;
}
}
@@ -1717,6 +1727,7 @@
default:
BUG();
+ return;
}
}
@@ -2106,6 +2117,11 @@
if (fieldmode)
field_offset = 1;
+ offset0 = 0;
+ offset1 = 0;
+ row_inc = 0;
+ pix_inc = 0;
+
if (oi->rotation_type == OMAP_DSS_ROT_DMA)
calc_dma_rotation_offset(oi->rotation, oi->mirror,
oi->screen_width, in_width, frame_height,
@@ -2316,8 +2332,10 @@
return !!REG_GET(DISPC_CONTROL, 1, 1);
else if (channel == OMAP_DSS_CHANNEL_LCD2)
return !!REG_GET(DISPC_CONTROL2, 0, 0);
- else
+ else {
BUG();
+ return false;
+ }
}
void dispc_mgr_enable(enum omap_channel channel, bool enable)
@@ -2593,8 +2611,10 @@
DSSDBG("channel %d xres %u yres %u\n", channel, timings->x_res,
timings->y_res);
- if (!dispc_mgr_timings_ok(channel, timings))
+ if (!dispc_mgr_timings_ok(channel, timings)) {
BUG();
+ return;
+ }
if (dispc_mgr_is_lcd(channel)) {
_dispc_mgr_set_lcd_timings(channel, timings->hsw, timings->hfp,
@@ -2658,6 +2678,7 @@
break;
default:
BUG();
+ return 0;
}
return r;
@@ -2688,6 +2709,7 @@
break;
default:
BUG();
+ return 0;
}
return r / lcd;
@@ -2720,6 +2742,7 @@
return hdmi_get_pixel_clock();
default:
BUG();
+ return 0;
}
}
}