msm: mdss: debug: provide unknown string when index is invalid
When index is not found in lookup table we should return unkown string, however current check is only based on array bounds, but there may be some indexes within the array that haven't been defined. A null check for those should be sufficient. Change-Id: I7fe7de572a95ae1482dc6a647979dfb7755270a7 Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
This commit is contained in:
parent
616011665d
commit
fecd461b57
2 changed files with 5 additions and 3 deletions
|
@ -28,10 +28,11 @@ static inline const char *mdss_mdp_pipetype2str(u32 ptype)
|
|||
PIPE_TYPE(VIG),
|
||||
PIPE_TYPE(RGB),
|
||||
PIPE_TYPE(DMA),
|
||||
PIPE_TYPE(CURSOR),
|
||||
#undef PIPE_TYPE
|
||||
};
|
||||
|
||||
if (ptype >= ARRAY_SIZE(strings))
|
||||
if (ptype >= ARRAY_SIZE(strings) || !strings[ptype])
|
||||
return "UNKOWN";
|
||||
|
||||
return strings[ptype];
|
||||
|
@ -62,7 +63,7 @@ static inline const char *mdss_mdp_format2str(u32 format)
|
|||
#undef FORMAT_NAME
|
||||
};
|
||||
|
||||
if (format >= ARRAY_SIZE(strings))
|
||||
if (format >= ARRAY_SIZE(strings) || !strings[format])
|
||||
return "UNKOWN";
|
||||
|
||||
return strings[format];
|
||||
|
|
|
@ -53,11 +53,12 @@ static inline const char *mdss_panel2str(u32 panel)
|
|||
PANEL_NAME(MIPI_CMD),
|
||||
PANEL_NAME(EDP),
|
||||
PANEL_NAME(HDMI),
|
||||
PANEL_NAME(DTV),
|
||||
PANEL_NAME(WRITEBACK),
|
||||
#undef PANEL_NAME
|
||||
};
|
||||
|
||||
if (panel >= ARRAY_SIZE(names))
|
||||
if (panel >= ARRAY_SIZE(names) || !names[panel])
|
||||
return "UNKNOWN";
|
||||
|
||||
return names[panel];
|
||||
|
|
Loading…
Add table
Reference in a new issue