diff options
author | Claudiu Beznea <claudiu.beznea@microchip.com> | 2023-05-31 10:28:54 +0300 |
---|---|---|
committer | Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com> | 2024-07-15 11:21:23 +0300 |
commit | fd39730c58890cd7f0a594231e19bb357f28877c (patch) | |
tree | 1f0c5af5f574877fd82564ff7fb9bf504de500f0 /drivers/gpu | |
parent | 3ac9384061b250ee40eda5facff10b85e2d5d3d8 (diff) | |
download | linux-fd39730c58890cd7f0a594231e19bb357f28877c.tar.xz |
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: 484e72d3146b ("drm/stm: ltdc: add support of ycbcr pixel formats")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Acked-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230531072854.142629-1-claudiu.beznea@microchip.com
Signed-off-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/stm/ltdc.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index 5576fdae4962..5aec1e58c968 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -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_fp)) * sizeof(*formats), GFP_KERNEL); + if (!formats) + return NULL; for (i = 0; i < ldev->caps.pix_fmt_nb; i++) { drm_fmt = ldev->caps.pix_fmt_drm[i]; |