Re: [PATCH] ASoC: Fix cs4270 error path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sorry I didn't get to this earlier.  I just fell off my radar.

On Sun, Aug 31, 2008 at 7:42 AM, Jean Delvare <khali@xxxxxxxxxxxx> wrote:
> The error path in cs4270_probe/cs4270_remove is pretty broken:
> * If cs4270_probe fails, codec is leaked.
> * If snd_soc_register_card fails, cs4270_i2c_driver stays registered.

So far, so good.

> * If I2C support is enabled but no I2C device is found, i2c_del_driver
>  is never called (neither in cs4270_probe nor in cs4270_remove.)

Hmm... The only time that can happen is if the device tree is wrong or
the hardware is broken.  This means that cs4270_i2c_probe() will
return an error.  What does i2c_add_driver() return in that case?  If
it still returns 0, then control_data will be NULL, but with your
patch, i2c_del_driver() will still be called.

Also, I think there's a bug in cs4270_i2c_probe(), where it will call
i2c_detach_driver() if it fails.  It shouldn't do that.  This is also
gated on codec->control_data, so it's a related bug.

Lastly, you may need to rebase the patch, since the code's changed.

-- 
Timur Tabi
Linux kernel developer at Freescale
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux