From: "Agrawal, Akshu" <Akshu.Agrawal@amd.com>
To: "Deucher, Alexander" <Alexander.Deucher@amd.com>,
'Guenter Roeck' <linux@roeck-us.net>,
Liam Girdwood <lgirdwood@gmail.com>,
"Mukunda, Vijendar" <Vijendar.Mukunda@amd.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
Dominik Behr <dbehr@chromium.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Daniel Kurtz <djkurtz@chromium.org>,
Takashi Iwai <tiwai@suse.com>, Mark Brown <broonie@kernel.org>
Subject: Re: [PATCH] ASoC: amd: Add error checking to probe function
Date: Tue, 21 Nov 2017 11:45:15 +0530 [thread overview]
Message-ID: <ab2e75d2-d1e4-860e-f1de-cf0ef60c94bc@amd.com> (raw)
In-Reply-To: <BN6PR12MB16524EF04A6F7050D60AC602F7230@BN6PR12MB1652.namprd12.prod.outlook.com>
On 11/21/2017 10:17 AM, Deucher, Alexander wrote:
>> -----Original Message-----
>> From: Guenter Roeck [mailto:groeck7@gmail.com] On Behalf Of Guenter
>> Roeck
>> Sent: Monday, November 20, 2017 11:28 PM
>> To: Liam Girdwood
>> Cc: Mark Brown; Jaroslav Kysela; Takashi Iwai; alsa-devel@alsa-project.org;
>> linux-kernel@vger.kernel.org; Guenter Roeck; Deucher, Alexander; Dominik
>> Behr; Daniel Kurtz
>> Subject: [PATCH] ASoC: amd: Add error checking to probe function
>>
>> The acp_audio_dma does not perform sufficient error checking in its probe
>> function. This can result in crashes if a critical error path is
>> encountered.
>>
>> Fixes: 7c31335a03b6a ("ASoC: AMD: add AMD ASoC ACP 2.x DMA driver")
>> Cc: Alex Deucher <alexander.deucher@amd.com>
>> Cc: Dominik Behr <dbehr@chromium.org>
>> Cc: Daniel Kurtz <djkurtz@chromium.org>
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>> ---
>> I didn't add an error check to acp_init() since I was not sure if
>> its return value is ignored on purpose.
>
> Vijendar, Akshu can you comment?
This is also the case of missing error check.
acp_init will return error if either sw reset did not happen or clock
did not get enabled. In both cases we should error out in probe.
>
> The patch looks good to me.
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
>
>>
>> sound/soc/amd/acp-pcm-dma.c | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-
>> dma.c
>> index 9f521a55d610..b5e41df6bb3a 100644
>> --- a/sound/soc/amd/acp-pcm-dma.c
>> +++ b/sound/soc/amd/acp-pcm-dma.c
>> @@ -1051,6 +1051,11 @@ static int acp_audio_probe(struct platform_device
>> *pdev)
>> struct resource *res;
>> const u32 *pdata = pdev->dev.platform_data;
>>
>> + if (!pdata) {
>> + dev_err(&pdev->dev, "Missing platform data\n");
>> + return -ENODEV;
>> + }
>> +
>> audio_drv_data = devm_kzalloc(&pdev->dev, sizeof(struct
>> audio_drv_data),
>> GFP_KERNEL);
>> if (audio_drv_data == NULL)
>> @@ -1058,6 +1063,8 @@ static int acp_audio_probe(struct platform_device
>> *pdev)
>>
>> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> audio_drv_data->acp_mmio = devm_ioremap_resource(&pdev-
>>> dev, res);
>> + if (IS_ERR(audio_drv_data->acp_mmio))
>> + return PTR_ERR(audio_drv_data->acp_mmio);
>>
>> /* The following members gets populated in device 'open'
>> * function. Till then interrupts are disabled in 'acp_init'
>> --
>> 2.7.4
>
next prev parent reply other threads:[~2017-11-21 6:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-21 4:27 [PATCH] ASoC: amd: Add error checking to probe function Guenter Roeck
2017-11-21 4:47 ` Deucher, Alexander
2017-11-21 6:15 ` Agrawal, Akshu [this message]
2017-11-21 15:08 ` Deucher, Alexander
2017-11-22 9:52 ` Mukunda,Vijendar
2017-11-27 18:52 ` Applied "ASoC: amd: Add error checking to probe function" to the asoc tree 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=ab2e75d2-d1e4-860e-f1de-cf0ef60c94bc@amd.com \
--to=akshu.agrawal@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Vijendar.Mukunda@amd.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=dbehr@chromium.org \
--cc=djkurtz@chromium.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=tiwai@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).