Commit c6eee968 authored by Tomi Valkeinen's avatar Tomi Valkeinen

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: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 36377357
...@@ -407,6 +407,7 @@ u32 dispc_mgr_get_vsync_irq(enum omap_channel channel) ...@@ -407,6 +407,7 @@ u32 dispc_mgr_get_vsync_irq(enum omap_channel channel)
return DISPC_IRQ_EVSYNC_ODD | DISPC_IRQ_EVSYNC_EVEN; return DISPC_IRQ_EVSYNC_ODD | DISPC_IRQ_EVSYNC_EVEN;
default: default:
BUG(); BUG();
return 0;
} }
} }
...@@ -421,6 +422,7 @@ u32 dispc_mgr_get_framedone_irq(enum omap_channel channel) ...@@ -421,6 +422,7 @@ u32 dispc_mgr_get_framedone_irq(enum omap_channel channel)
return 0; return 0;
default: default:
BUG(); BUG();
return 0;
} }
} }
...@@ -739,7 +741,7 @@ static void dispc_ovl_set_color_mode(enum omap_plane plane, ...@@ -739,7 +741,7 @@ static void dispc_ovl_set_color_mode(enum omap_plane plane,
case OMAP_DSS_COLOR_XRGB16_1555: case OMAP_DSS_COLOR_XRGB16_1555:
m = 0xf; break; m = 0xf; break;
default: default:
BUG(); break; BUG(); return;
} }
} else { } else {
switch (color_mode) { switch (color_mode) {
...@@ -776,7 +778,7 @@ static void dispc_ovl_set_color_mode(enum omap_plane plane, ...@@ -776,7 +778,7 @@ static void dispc_ovl_set_color_mode(enum omap_plane plane,
case OMAP_DSS_COLOR_XRGB16_1555: case OMAP_DSS_COLOR_XRGB16_1555:
m = 0xf; break; m = 0xf; break;
default: default:
BUG(); break; BUG(); return;
} }
} }
...@@ -820,6 +822,7 @@ void dispc_ovl_set_channel_out(enum omap_plane plane, enum omap_channel channel) ...@@ -820,6 +822,7 @@ void dispc_ovl_set_channel_out(enum omap_plane plane, enum omap_channel channel)
break; break;
default: default:
BUG(); BUG();
return;
} }
val = FLD_MOD(val, chan, shift, shift); val = FLD_MOD(val, chan, shift, shift);
...@@ -847,6 +850,7 @@ static enum omap_channel dispc_ovl_get_channel_out(enum omap_plane plane) ...@@ -847,6 +850,7 @@ static enum omap_channel dispc_ovl_get_channel_out(enum omap_plane plane)
break; break;
default: default:
BUG(); BUG();
return 0;
} }
val = dispc_read_reg(DISPC_OVL_ATTRIBUTES(plane)); val = dispc_read_reg(DISPC_OVL_ATTRIBUTES(plane));
...@@ -1209,6 +1213,7 @@ static void dispc_ovl_set_accu_uv(enum omap_plane plane, ...@@ -1209,6 +1213,7 @@ static void dispc_ovl_set_accu_uv(enum omap_plane plane,
break; break;
default: default:
BUG(); BUG();
return;
} }
switch (color_mode) { switch (color_mode) {
...@@ -1224,6 +1229,7 @@ static void dispc_ovl_set_accu_uv(enum omap_plane plane, ...@@ -1224,6 +1229,7 @@ static void dispc_ovl_set_accu_uv(enum omap_plane plane,
break; break;
default: default:
BUG(); BUG();
return;
} }
accu_val = &accu_table[idx]; accu_val = &accu_table[idx];
...@@ -1339,6 +1345,7 @@ static void dispc_ovl_set_scaling_uv(enum omap_plane plane, ...@@ -1339,6 +1345,7 @@ static void dispc_ovl_set_scaling_uv(enum omap_plane plane,
break; break;
default: default:
BUG(); BUG();
return;
} }
if (out_width != orig_width) if (out_width != orig_width)
...@@ -1466,6 +1473,7 @@ static int color_mode_to_bpp(enum omap_color_mode color_mode) ...@@ -1466,6 +1473,7 @@ static int color_mode_to_bpp(enum omap_color_mode color_mode)
return 32; return 32;
default: default:
BUG(); BUG();
return 0;
} }
} }
...@@ -1479,6 +1487,7 @@ static s32 pixinc(int pixels, u8 ps) ...@@ -1479,6 +1487,7 @@ static s32 pixinc(int pixels, u8 ps)
return 1 - (-pixels + 1) * ps; return 1 - (-pixels + 1) * ps;
else else
BUG(); BUG();
return 0;
} }
static void calc_vrfb_rotation_offset(u8 rotation, bool mirror, static void calc_vrfb_rotation_offset(u8 rotation, bool mirror,
...@@ -1562,6 +1571,7 @@ static void calc_vrfb_rotation_offset(u8 rotation, bool mirror, ...@@ -1562,6 +1571,7 @@ static void calc_vrfb_rotation_offset(u8 rotation, bool mirror,
default: default:
BUG(); BUG();
return;
} }
} }
...@@ -1717,6 +1727,7 @@ static void calc_dma_rotation_offset(u8 rotation, bool mirror, ...@@ -1717,6 +1727,7 @@ static void calc_dma_rotation_offset(u8 rotation, bool mirror,
default: default:
BUG(); BUG();
return;
} }
} }
...@@ -2106,6 +2117,11 @@ int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi, ...@@ -2106,6 +2117,11 @@ int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi,
if (fieldmode) if (fieldmode)
field_offset = 1; field_offset = 1;
offset0 = 0;
offset1 = 0;
row_inc = 0;
pix_inc = 0;
if (oi->rotation_type == OMAP_DSS_ROT_DMA) if (oi->rotation_type == OMAP_DSS_ROT_DMA)
calc_dma_rotation_offset(oi->rotation, oi->mirror, calc_dma_rotation_offset(oi->rotation, oi->mirror,
oi->screen_width, in_width, frame_height, oi->screen_width, in_width, frame_height,
...@@ -2316,8 +2332,10 @@ bool dispc_mgr_is_enabled(enum omap_channel channel) ...@@ -2316,8 +2332,10 @@ bool dispc_mgr_is_enabled(enum omap_channel channel)
return !!REG_GET(DISPC_CONTROL, 1, 1); return !!REG_GET(DISPC_CONTROL, 1, 1);
else if (channel == OMAP_DSS_CHANNEL_LCD2) else if (channel == OMAP_DSS_CHANNEL_LCD2)
return !!REG_GET(DISPC_CONTROL2, 0, 0); return !!REG_GET(DISPC_CONTROL2, 0, 0);
else else {
BUG(); BUG();
return false;
}
} }
void dispc_mgr_enable(enum omap_channel channel, bool enable) void dispc_mgr_enable(enum omap_channel channel, bool enable)
...@@ -2593,8 +2611,10 @@ void dispc_mgr_set_timings(enum omap_channel channel, ...@@ -2593,8 +2611,10 @@ void dispc_mgr_set_timings(enum omap_channel channel,
DSSDBG("channel %d xres %u yres %u\n", channel, timings->x_res, DSSDBG("channel %d xres %u yres %u\n", channel, timings->x_res,
timings->y_res); timings->y_res);
if (!dispc_mgr_timings_ok(channel, timings)) if (!dispc_mgr_timings_ok(channel, timings)) {
BUG(); BUG();
return;
}
if (dispc_mgr_is_lcd(channel)) { if (dispc_mgr_is_lcd(channel)) {
_dispc_mgr_set_lcd_timings(channel, timings->hsw, timings->hfp, _dispc_mgr_set_lcd_timings(channel, timings->hsw, timings->hfp,
...@@ -2658,6 +2678,7 @@ unsigned long dispc_fclk_rate(void) ...@@ -2658,6 +2678,7 @@ unsigned long dispc_fclk_rate(void)
break; break;
default: default:
BUG(); BUG();
return 0;
} }
return r; return r;
...@@ -2688,6 +2709,7 @@ unsigned long dispc_mgr_lclk_rate(enum omap_channel channel) ...@@ -2688,6 +2709,7 @@ unsigned long dispc_mgr_lclk_rate(enum omap_channel channel)
break; break;
default: default:
BUG(); BUG();
return 0;
} }
return r / lcd; return r / lcd;
...@@ -2720,6 +2742,7 @@ unsigned long dispc_mgr_pclk_rate(enum omap_channel channel) ...@@ -2720,6 +2742,7 @@ unsigned long dispc_mgr_pclk_rate(enum omap_channel channel)
return hdmi_get_pixel_clock(); return hdmi_get_pixel_clock();
default: default:
BUG(); BUG();
return 0;
} }
} }
} }
......
This diff is collapsed.
...@@ -304,6 +304,7 @@ int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev) ...@@ -304,6 +304,7 @@ int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev)
return 24; return 24;
default: default:
BUG(); BUG();
return 0;
} }
} }
EXPORT_SYMBOL(omapdss_default_get_recommended_bpp); EXPORT_SYMBOL(omapdss_default_get_recommended_bpp);
...@@ -347,6 +348,7 @@ bool dss_use_replication(struct omap_dss_device *dssdev, ...@@ -347,6 +348,7 @@ bool dss_use_replication(struct omap_dss_device *dssdev,
break; break;
default: default:
BUG(); BUG();
return false;
} }
return bpp > 16; return bpp > 16;
......
...@@ -446,6 +446,7 @@ u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt) ...@@ -446,6 +446,7 @@ u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt)
return 16; return 16;
default: default:
BUG(); BUG();
return 0;
} }
} }
...@@ -2003,6 +2004,7 @@ static unsigned dsi_get_line_buf_size(struct platform_device *dsidev) ...@@ -2003,6 +2004,7 @@ static unsigned dsi_get_line_buf_size(struct platform_device *dsidev)
return 1365 * 3; /* 1365x24 bits */ return 1365 * 3; /* 1365x24 bits */
default: default:
BUG(); BUG();
return 0;
} }
} }
...@@ -2415,6 +2417,7 @@ static void dsi_config_tx_fifo(struct platform_device *dsidev, ...@@ -2415,6 +2417,7 @@ static void dsi_config_tx_fifo(struct platform_device *dsidev,
if (add + size > 4) { if (add + size > 4) {
DSSERR("Illegal FIFO configuration\n"); DSSERR("Illegal FIFO configuration\n");
BUG(); BUG();
return;
} }
v = FLD_VAL(add, 2, 0) | FLD_VAL(size, 7, 4); v = FLD_VAL(add, 2, 0) | FLD_VAL(size, 7, 4);
...@@ -2447,6 +2450,7 @@ static void dsi_config_rx_fifo(struct platform_device *dsidev, ...@@ -2447,6 +2450,7 @@ static void dsi_config_rx_fifo(struct platform_device *dsidev,
if (add + size > 4) { if (add + size > 4) {
DSSERR("Illegal FIFO configuration\n"); DSSERR("Illegal FIFO configuration\n");
BUG(); BUG();
return;
} }
v = FLD_VAL(add, 2, 0) | FLD_VAL(size, 7, 4); v = FLD_VAL(add, 2, 0) | FLD_VAL(size, 7, 4);
...@@ -2588,6 +2592,7 @@ static int dsi_sync_vc(struct platform_device *dsidev, int channel) ...@@ -2588,6 +2592,7 @@ static int dsi_sync_vc(struct platform_device *dsidev, int channel)
return dsi_sync_vc_l4(dsidev, channel); return dsi_sync_vc_l4(dsidev, channel);
default: default:
BUG(); BUG();
return -EINVAL;
} }
} }
...@@ -3156,6 +3161,7 @@ static int dsi_vc_generic_send_read_request(struct omap_dss_device *dssdev, ...@@ -3156,6 +3161,7 @@ static int dsi_vc_generic_send_read_request(struct omap_dss_device *dssdev,
data = reqdata[0] | (reqdata[1] << 8); data = reqdata[0] | (reqdata[1] << 8);
} else { } else {
BUG(); BUG();
return -EINVAL;
} }
r = dsi_vc_send_short(dsidev, channel, data_type, data, 0); r = dsi_vc_send_short(dsidev, channel, data_type, data, 0);
...@@ -3270,7 +3276,6 @@ static int dsi_vc_read_rx_fifo(struct platform_device *dsidev, int channel, ...@@ -3270,7 +3276,6 @@ static int dsi_vc_read_rx_fifo(struct platform_device *dsidev, int channel,
goto err; goto err;
} }
BUG();
err: err:
DSSERR("dsi_vc_read_rx_fifo(ch %d type %s) failed\n", channel, DSSERR("dsi_vc_read_rx_fifo(ch %d type %s) failed\n", channel,
type == DSS_DSI_CONTENT_GENERIC ? "GENERIC" : "DCS"); type == DSS_DSI_CONTENT_GENERIC ? "GENERIC" : "DCS");
...@@ -3879,6 +3884,7 @@ static int dsi_proto_config(struct omap_dss_device *dssdev) ...@@ -3879,6 +3884,7 @@ static int dsi_proto_config(struct omap_dss_device *dssdev)
break; break;
default: default:
BUG(); BUG();
return -EINVAL;
} }
r = dsi_read_reg(dsidev, DSI_CTRL); r = dsi_read_reg(dsidev, DSI_CTRL);
...@@ -4119,6 +4125,7 @@ int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel) ...@@ -4119,6 +4125,7 @@ int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
break; break;
default: default:
BUG(); BUG();
return -EINVAL;
}; };
dsi_if_enable(dsidev, false); dsi_if_enable(dsidev, false);
......
...@@ -325,6 +325,7 @@ void dss_select_dispc_clk_source(enum omap_dss_clk_source clk_src) ...@@ -325,6 +325,7 @@ void dss_select_dispc_clk_source(enum omap_dss_clk_source clk_src)
break; break;
default: default:
BUG(); BUG();
return;
} }
dss_feat_get_reg_field(FEAT_REG_DISPC_CLK_SWITCH, &start, &end); dss_feat_get_reg_field(FEAT_REG_DISPC_CLK_SWITCH, &start, &end);
...@@ -358,6 +359,7 @@ void dss_select_dsi_clk_source(int dsi_module, ...@@ -358,6 +359,7 @@ void dss_select_dsi_clk_source(int dsi_module,
break; break;
default: default:
BUG(); BUG();
return;
} }
pos = dsi_module == 0 ? 1 : 10; pos = dsi_module == 0 ? 1 : 10;
...@@ -393,6 +395,7 @@ void dss_select_lcd_clk_source(enum omap_channel channel, ...@@ -393,6 +395,7 @@ void dss_select_lcd_clk_source(enum omap_channel channel,
break; break;
default: default:
BUG(); BUG();
return;
} }
pos = channel == OMAP_DSS_CHANNEL_LCD ? 0 : 12; pos = channel == OMAP_DSS_CHANNEL_LCD ? 0 : 12;
......
...@@ -415,6 +415,7 @@ static const struct venc_config *venc_timings_to_config( ...@@ -415,6 +415,7 @@ static const struct venc_config *venc_timings_to_config(
return &venc_config_ntsc_trm; return &venc_config_ntsc_trm;
BUG(); BUG();
return NULL;
} }
static int venc_power_on(struct omap_dss_device *dssdev) static int venc_power_on(struct omap_dss_device *dssdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment