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 <[email protected]>
---

Hi,

This has been addressed using kmerr.cocci script proposed for update
at [1].

Thank you,
Claudiu Beznea

[1] 
https://lore.kernel.org/all/[email protected]/

 drivers/gpu/drm/stm/ltdc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 03c6becda795..9f3ac54d4cb3 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -1579,6 +1579,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];
-- 
2.34.1

Reply via email to