From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Hans de Goede <hdegoede@redhat.com>,
Jing Xiangfeng <jingxiangfeng@huawei.com>,
cezary.rojewski@intel.com, liam.r.girdwood@linux.intel.com,
yang.jie@linux.intel.com, broonie@kernel.org, perex@perex.cz,
tiwai@suse.com, kuninori.morimoto.gx@renesas.com,
paul@crapouillou.net
Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: Intel: bytcht_es8316: Add missed put_device()
Date: Tue, 14 Jul 2020 10:32:59 -0500 [thread overview]
Message-ID: <48bdc22e-a0fc-0402-a003-1d0736107e8a@linux.intel.com> (raw)
In-Reply-To: <25abce87-5572-a78a-f001-7776f07be4ac@redhat.com>
On 7/14/20 8:33 AM, Hans de Goede wrote:
> Hi,
>
> On 7/14/20 10:09 AM, Jing Xiangfeng wrote:
>> snd_byt_cht_es8316_mc_probe() misses to call put_device() in an error
>> path. Add the missed function call to fix it.
>>
>> Fixes: ba49cf6f8e4a ("ASoC: Intel: bytcht_es8316: Add quirk for
>> inverted jack detect")
>> Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
>
> Patch looks good to me:
>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Actually the existing code looks quite odd to me:
if (cnt) {
ret = device_add_properties(codec_dev, props);
if (ret)
return ret;
}
devm_acpi_dev_add_driver_gpios(codec_dev, byt_cht_es8316_gpios);
priv->speaker_en_gpio =
gpiod_get_index(codec_dev, "speaker-enable", 0,
/* see comment in byt_cht_es8316_resume */
GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE);
put_device(codec_dev);
if the first branch is not taken the put_device() will not be balanced.
Shouldn't this be:
if (cnt) {
ret = device_add_properties(codec_dev, props);
put_device(codec_dev);
if (ret)
return ret;
}
devm_acpi_dev_add_driver_gpios(codec_dev, byt_cht_es8316_gpios);
priv->speaker_en_gpio =
gpiod_get_index(codec_dev, "speaker-enable", 0,
/* see comment in byt_cht_es8316_resume */
GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE);
/* removed put_device(codec_dev); */
>
> Regards,
>
> Hans
>
>
>> ---
>> sound/soc/intel/boards/bytcht_es8316.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/sound/soc/intel/boards/bytcht_es8316.c
>> b/sound/soc/intel/boards/bytcht_es8316.c
>> index 9e5fc9430628..ecbc58e8a37f 100644
>> --- a/sound/soc/intel/boards/bytcht_es8316.c
>> +++ b/sound/soc/intel/boards/bytcht_es8316.c
>> @@ -543,8 +543,10 @@ static int snd_byt_cht_es8316_mc_probe(struct
>> platform_device *pdev)
>> if (cnt) {
>> ret = device_add_properties(codec_dev, props);
>> - if (ret)
>> + if (ret) {
>> + put_device(codec_dev);
>> return ret;
>> + }
>> }
>> devm_acpi_dev_add_driver_gpios(codec_dev, byt_cht_es8316_gpios);
>>
>
next prev parent reply other threads:[~2020-07-14 15:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-14 8:09 [PATCH] ASoC: Intel: bytcht_es8316: Add missed put_device() Jing Xiangfeng
2020-07-14 13:33 ` Hans de Goede
2020-07-14 15:32 ` Pierre-Louis Bossart [this message]
2020-07-14 19:29 ` Hans de Goede
2020-07-16 16:48 ` Pierre-Louis Bossart
2020-07-16 23:57 ` 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=48bdc22e-a0fc-0402-a003-1d0736107e8a@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=cezary.rojewski@intel.com \
--cc=hdegoede@redhat.com \
--cc=jingxiangfeng@huawei.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=liam.r.girdwood@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paul@crapouillou.net \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=yang.jie@linux.intel.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).