diff options
author | Xiaoke Wang | 2022-03-14 18:36:45 +0800 |
---|---|---|
committer | Mark Brown | 2022-03-16 16:39:17 +0000 |
commit | d39664cb758e9e329ac3ba05bd4f813f928f63c2 (patch) | |
tree | 305a148c9ada1e4be018f228ecaefe7167615ff4 /sound | |
parent | a8ae15ead9c9d10671c3f76cb0749dec6e571ce7 (diff) |
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>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/samsung/i2s.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 309badc97290..70c827162be4 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -1349,6 +1349,10 @@ static int i2s_create_secondary_device(struct samsung_i2s_priv *priv) return -ENOMEM; pdev_sec->driver_override = kstrdup("samsung-i2s", GFP_KERNEL); + if (!pdev_sec->driver_override) { + platform_device_put(pdev_sec); + return -ENOMEM; + } ret = platform_device_add(pdev_sec); if (ret < 0) { |