[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 9 Sep 2022 17:00:32 +0100
From: Richard Fitzgerald <rf@...nsource.cirrus.com>
To: Martin Povišer <povik+lin@...ebit.org>
CC: James Schulman <james.schulman@...rus.com>,
David Rhodes <david.rhodes@...rus.com>,
Lucas Tanure <tanureal@...nsource.cirrus.com>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
"Rob Herring" <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Charles Keepax <ckeepax@...nsource.cirrus.com>,
ChiYuan Huang <cy_huang@...htek.com>,
Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
Lukas Bulwahn <lukas.bulwahn@...il.com>,
Matt Flax <flatmax@...tmax.com>,
- <patches@...nsource.cirrus.com>, <alsa-devel@...a-project.org>,
<devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<asahi@...ts.linux.dev>
Subject: Re: [PATCH 07/10] ASoC: cs42l42: Split I2C identity into separate
module
On 09/09/2022 16:44, Martin Povišer wrote:
>
>> On 9. 9. 2022, at 17:40, Richard Fitzgerald <rf@...nsource.cirrus.com> wrote:
>>
>> On 09/09/2022 14:53, Martin Povišer wrote:
>>> +static int cs42l42_i2c_probe(struct i2c_client *i2c_client)
>>> +{
>>> + struct device *dev = &i2c_client->dev;
>>> + struct cs42l42_private *cs42l42;
>>> + struct regmap *regmap;
>>> + int ret;
>>> +
>>> + cs42l42 = devm_kzalloc(dev, sizeof(*cs42l42), GFP_KERNEL);
>>> + if (!cs42l42)
>>> + return -ENOMEM;
>>> +
>>> + regmap = devm_regmap_init_i2c(i2c_client, &cs42l42_regmap);
>>> + if (IS_ERR(regmap)) {
>>> + ret = PTR_ERR(regmap);
>>> + dev_err(&i2c_client->dev, "regmap_init() failed: %d\n", ret);
>>> + return ret;
>>> + }
>>> +
>>> + cs42l42->dev = dev;
>>> + cs42l42->regmap = regmap;
>>> + cs42l42->irq = i2c_client->irq;
>>> +
>>> + ret = cs42l42_common_probe(cs42l42, &cs42l42_soc_component, &cs42l42_dai);
>>> + if (ret)
>>> + return ret;
>>> +
>>> + ret = cs42l42_init(cs42l42);
>>> + if (ret)
>>> + cs42l42_common_remove(cs42l42);
>>
>> This introduces a bug that regulator_bulk_disable() is called
>> twice if there is an error.
>>
>> cs42l42_init() was supposed to clean up if it returns an error, which
>> it nearly does, but my original patch is missing the call to free_irq()
>> in the error paths of cs42l42_init().
>
> Ah! I didn’t inspect it closely enough then, I only ran into the missing
> free_irq.
>
Yes, that's a bug. I just put a comment on the patch that introduced it.
When I split probe() into two, I accidentally missed out those two lines
to call free_irq().
> Martin
>
Powered by blists - more mailing lists