Commit fd39730c authored by Claudiu Beznea's avatar Claudiu Beznea Committed by Raphael Gallais-Pou

drm/stm: ltdc: check memory returned by devm_kzalloc()

devm_kzalloc() can fail and return NULL pointer. Check its return status.
Identified with Coccinelle (kmerr.cocci script).

Fixes: 484e72d3 ("drm/stm: ltdc: add support of ycbcr pixel formats")
Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
Acked-by: default avatarRaphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230531072854.142629-1-claudiu.beznea@microchip.comSigned-off-by: default avatarRaphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
parent 3ac93840
...@@ -1580,6 +1580,8 @@ static struct drm_plane *ltdc_plane_create(struct drm_device *ddev, ...@@ -1580,6 +1580,8 @@ static struct drm_plane *ltdc_plane_create(struct drm_device *ddev,
ARRAY_SIZE(ltdc_drm_fmt_ycbcr_sp) + ARRAY_SIZE(ltdc_drm_fmt_ycbcr_sp) +
ARRAY_SIZE(ltdc_drm_fmt_ycbcr_fp)) * ARRAY_SIZE(ltdc_drm_fmt_ycbcr_fp)) *
sizeof(*formats), GFP_KERNEL); sizeof(*formats), GFP_KERNEL);
if (!formats)
return NULL;
for (i = 0; i < ldev->caps.pix_fmt_nb; i++) { for (i = 0; i < ldev->caps.pix_fmt_nb; i++) {
drm_fmt = ldev->caps.pix_fmt_drm[i]; drm_fmt = ldev->caps.pix_fmt_drm[i];
......
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