Skip to content

Commit d39664c

Browse files
x2018broonie
authored andcommitted
ASoC: samsung: i2s: check the return value of kstrdup()
kstrdup() is a memory allocation function which can return NULL when some internal memory errors happen. It is better to check the return value of it to catch the error in time. Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com> Link: https://lore.kernel.org/r/tencent_EC21778DC383823CBC4069EA9F0B84943905@qq.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent a8ae15e commit d39664c

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

sound/soc/samsung/i2s.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,6 +1349,10 @@ static int i2s_create_secondary_device(struct samsung_i2s_priv *priv)
13491349
return -ENOMEM;
13501350

13511351
pdev_sec->driver_override = kstrdup("samsung-i2s", GFP_KERNEL);
1352+
if (!pdev_sec->driver_override) {
1353+
platform_device_put(pdev_sec);
1354+
return -ENOMEM;
1355+
}
13521356

13531357
ret = platform_device_add(pdev_sec);
13541358
if (ret < 0) {

0 commit comments

Comments
 (0)