From: "Timur Tabi" Subject: Re: [PATCH] ASoC: Fix cs4270 error path Date: Mon, 29 Sep 2008 08:42:15 -0500 Message-ID: References: <20080831144214.62a17be6@hyperion.delvare> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-gx0-f17.google.com (mail-gx0-f17.google.com [209.85.217.17]) by alsa0.perex.cz (Postfix) with ESMTP id 2687524397 for ; Mon, 29 Sep 2008 15:42:17 +0200 (CEST) Received: by gxk10 with SMTP id 10so12639016gxk.8 for ; Mon, 29 Sep 2008 06:42:15 -0700 (PDT) In-Reply-To: <20080831144214.62a17be6@hyperion.delvare> Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Jean Delvare , Takashi Iwai Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org On Sun, Aug 31, 2008 at 7:42 AM, Jean Delvare 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. > * 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.) > > Fix the first 2 problems by implementing a clean error path in > cs4270_probe and jumping to its labels as needed. Fix the 3rd problem > by removing the condition to call i2c_del_driver in cs4270_remove. > > Signed-off-by: Jean Delvare Acked-By: Timur Tabi Takashi, this patch needs to go into 2.6.27 as well. Sorry about that. I don't know how I missed so many problems with my code. -- Timur Tabi Linux kernel developer at Freescale