osd: avoid color_info NULL [1/1]
authorjian.cao <jian.cao@amlogic.com>
Fri, 27 Aug 2021 06:21:43 +0000 (14:21 +0800)
committerNolen Johnson <johnsonnolen@gmail.com>
Tue, 21 Dec 2021 18:34:38 +0000 (13:34 -0500)
PD#SWPL-57980

Problem:
after the device is powered on
plug in the HDMI cable a few seconds
then OSD panic

Solution:
avoid color_info NULL

Verify:
g12a

Change-Id: I69202bc06d889e59a391b50b609237689eb29d31
Signed-off-by: jian.cao <jian.cao@amlogic.com>
drivers/amlogic/media/osd/osd_hw.c

index e1d73ef6f2697d175e9e82b2b0b9017b64065efa..88c0ceb2bcff960dde006be8332ff300e7c395ff 100644 (file)
@@ -9161,10 +9161,13 @@ static int osd_setting_order(u32 output_index)
        for (i = 0; i < osd_count; i++) {
                if (osd_hw.enable[i]) {
                        struct hw_osd_reg_s *osd_reg = &hw_osd_reg_array[i];
-                       enum color_index_e idx =
-                               osd_hw.color_info[i]->color_index;
+                       enum color_index_e idx = COLOR_INDEX_32_BGRX;
                        bool rgbx = false;
 
+                       if (osd_hw.color_info[i])
+                               idx = osd_hw.color_info[i]->color_index;
+                       else
+                               osd_log_err("osd%d color_info is NULL\n", i);
                        /* update = is_freescale_para_changed(i); */
                        if (!osd_hw.osd_afbcd[i].enable)
                                canvas_config(osd_hw.fb_gem[i].canvas_idx,