mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Miaoqian Lin <linmq006@gmail.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Eric Millbrandt <emillbrandt@dekaresearch.com>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: fsl: Add missing error handling in pcm030_fabric_probe
Date: Wed, 26 Jan 2022 12:58:01 +0000	[thread overview]
Message-ID: <YfFFWSVgnbL6ETxo@sirena.org.uk> (raw)
In-Reply-To: <20220126113307.1673-1-linmq006@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 904 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2022-01-26 12:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-26 11:33 Miaoqian Lin
2022-01-26 12:58 ` Mark Brown [this message]
2022-01-27 13:13   ` [PATCH v2] " Miaoqian Lin
2022-01-28 15:58     ` 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=YfFFWSVgnbL6ETxo@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=emillbrandt@dekaresearch.com \
    --cc=lgirdwood@gmail.com \
    --cc=linmq006@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --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

Powered by JetHome