[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YfFFWSVgnbL6ETxo@sirena.org.uk>
Date: Wed, 26 Jan 2022 12:58:01 +0000
From: Mark Brown <broonie@...nel.org>
To: Miaoqian Lin <linmq006@...il.com>
Cc: Liam Girdwood <lgirdwood@...il.com>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Eric Millbrandt <emillbrandt@...aresearch.com>,
alsa-devel@...a-project.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ASoC: fsl: Add missing error handling in
pcm030_fabric_probe
On Wed, Jan 26, 2022 at 11:33:04AM +0000, Miaoqian Lin wrote:
> Add the missing platform_device_put() and platform_device_del()
> before return from pcm030_fabric_probe in the error handling case.
> ret = platform_device_add(pdata->codec_device);
> - if (ret)
> + if (ret) {
> dev_err(&op->dev, "platform_device_add() failed: %d\n", ret);
> + goto exit_device_put;
> + }
>
> ret = snd_soc_register_card(card);
> if (ret)
> dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret);
>
> platform_set_drvdata(op, pdata);
> + return ret;
This means we'll skip the cleanup of the platform device that you just
added if card creation fails:
> +exit_release_dev:
> + platform_device_del(pdata->codec_device);
> +exit_device_put:
> + platform_device_put(pdata->codec_device);
> return ret;
It needs to return early only if the card registration failed.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists