mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 19:13:47 +02:00
drm: xlnx: zynqmp_dpsub: Add NULL check in zynqmp_audio_init
devm_kasprintf() calls can return null pointers on failure.
But some return values were not checked in zynqmp_audio_init().
Add NULL check in zynqmp_audio_init(), avoid referencing null
pointers in the subsequent code.
Fixes: 3ec5c15793 ("drm: xlnx: zynqmp_dpsub: Add DP audio support")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Charles Han <hanchunchao@inspur.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250211102049.6468-1-hanchunchao@inspur.com
This commit is contained in:
parent
28b529a985
commit
d0660f9c58
|
|
@ -323,12 +323,16 @@ int zynqmp_audio_init(struct zynqmp_dpsub *dpsub)
|
|||
|
||||
audio->dai_name = devm_kasprintf(dev, GFP_KERNEL,
|
||||
"%s-dai", dev_name(dev));
|
||||
if (!audio->dai_name)
|
||||
return -ENOMEM;
|
||||
|
||||
for (unsigned int i = 0; i < ZYNQMP_NUM_PCMS; ++i) {
|
||||
audio->link_names[i] = devm_kasprintf(dev, GFP_KERNEL,
|
||||
"%s-dp-%u", dev_name(dev), i);
|
||||
audio->pcm_names[i] = devm_kasprintf(dev, GFP_KERNEL,
|
||||
"%s-pcm-%u", dev_name(dev), i);
|
||||
if (!audio->link_names[i] || !audio->pcm_names[i])
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
audio->base = devm_platform_ioremap_resource_byname(pdev, "aud");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user