From: christophe.jaillet@wanadoo.fr (Christophe JAILLET)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe'
Date: Thu, 15 Jun 2017 07:53:11 +0200 [thread overview]
Message-ID: <20170615055311.8049-1-christophe.jaillet@wanadoo.fr> (raw)
If this memory allocation fail, we must disable what has been enabled.
Do not return immediately but go thrue the error handling path instead.
Also use 'devm_kmemdup' instead of 'devm_kzalloc+memcpy' to simplify code.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
sound/soc/rockchip/rockchip_i2s.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
index af5e0da144f7..f3aa3dfe914b 100644
--- a/sound/soc/rockchip/rockchip_i2s.c
+++ b/sound/soc/rockchip/rockchip_i2s.c
@@ -643,12 +643,13 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
goto err_pm_disable;
}
- soc_dai = devm_kzalloc(&pdev->dev,
+ soc_dai = devm_kmemdup(&pdev->dev, &rockchip_i2s_dai
sizeof(*soc_dai), GFP_KERNEL);
- if (!soc_dai)
- return -ENOMEM;
+ if (!soc_dai) {
+ err = -ENOMEM;
+ goto err_pm_disable;
+ }
- memcpy(soc_dai, &rockchip_i2s_dai, sizeof(*soc_dai));
if (!of_property_read_u32(node, "rockchip,playback-channels", &val)) {
if (val >= 2 && val <= 8)
soc_dai->playback.channels_max = val;
--
2.11.0
next reply other threads:[~2017-06-15 5:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-15 5:53 Christophe JAILLET [this message]
2017-06-15 11:38 ` [PATCH] ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe' kbuild test robot
2017-06-15 17:20 ` Applied "ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe'" to the asoc tree Mark Brown
2017-06-15 17:32 ` Christophe JAILLET
2017-06-15 19:12 ` Mark Brown
2017-06-16 4:57 ` Christophe JAILLET
2017-06-16 9:18 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170615055311.8049-1-christophe.jaillet@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox