Subject: Re: [PATCH 2/3] macsonic: free irq if sonic_open() fails

From: Dan Carpenter <[email-masked]>
Date: Sat, 10 Jul 2010 13:22:29 +0200

On Sat, Jul 10, 2010 at 03:01:00PM +0400, Kulikov Vasiliy wrote:

> +	if (dev->irq == IRQ_AUTO_3) {
> +		retval = request_irq(IRQ_NUBUS_9, macsonic_interrupt,
> +					IRQ_FLG_FAST, "sonic", dev);
> +		if (retval) {
> +			printk(KERN_ERR "%s: unable to get IRQ %d.\n",
> +					dev->name, IRQ_NUBUS_9);
> +			goto err_irq;
>  		}
> -	return sonic_open(dev);
> +	}
> +	retval = sonic_open(dev);
> +	if (retval)
> +		goto err_irq_nubus;
> +	return 0;
> +
> +err_irq_nubus:

This should be:

+	if (dev->irq == IRQ_AUTO_3)
+		free_irq(IRQ_NUBUS_9, dev);

> +err_irq:
> +	free_irq(dev->irq, dev);
> +err:
> +	return retval;
>  }

regards,
dan carpenter