From: Dan Carpenter <dan.carpenter@oracle.com>
To: ryder.lee@mediatek.com
Cc: alsa-devel@alsa-project.org, linux-mediatek@lists.infradead.org
Subject: [bug report] ASoC: mediatek: modify MT2701 AFE driver to adapt mfd device
Date: Mon, 22 Jan 2018 13:01:38 +0300 [thread overview]
Message-ID: <20180122100138.GA20468@mwanda> (raw)
Hello Ryder Lee,
The patch dfa3cbb83e09: "ASoC: mediatek: modify MT2701 AFE driver to
adapt mfd device" from Jan 4, 2018, leads to the following static
checker warning:
sound/soc/mediatek/mt2701/mt2701-afe-pcm.c:1535 mt2701_afe_pcm_dev_probe()
error: double free of 'component'
sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
1509 pm_runtime_get_sync(dev);
1510
1511 ret = snd_soc_register_platform(dev, &mtk_afe_pcm_platform);
1512 if (ret) {
1513 dev_warn(dev, "err_platform\n");
1514 goto err_platform;
1515 }
1516
1517 ret = snd_soc_add_component(dev, component,
^^^^^^^^^
snd_soc_add_component() frees "component" on error. This seems like a
layering violation to me, and it naturally leads to bugs like this.
1518 &mt2701_afe_pcm_dai_component,
1519 mt2701_afe_pcm_dais,
1520 ARRAY_SIZE(mt2701_afe_pcm_dais));
1521 if (ret) {
1522 dev_warn(dev, "err_dai_component\n");
1523 goto err_dai_component;
1524 }
1525
1526 return 0;
1527
1528 err_dai_component:
1529 snd_soc_unregister_platform(dev);
1530 err_platform:
1531 pm_runtime_put_sync(dev);
1532 err_pm_disable:
1533 pm_runtime_disable(dev);
1534 err_init_clock:
1535 kfree(component);
^^^^^^^^^
Double free
1536
1537 return ret;
1538 }
regards,
dan carpenter
next reply other threads:[~2018-01-22 10:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-22 10:01 Dan Carpenter [this message]
2018-01-22 11:38 ` [bug report] ASoC: mediatek: modify MT2701 AFE driver to adapt mfd device Ryder Lee
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=20180122100138.GA20468@mwanda \
--to=dan.carpenter@oracle.com \
--cc=alsa-devel@alsa-project.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=ryder.lee@mediatek.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.