Re: [PATCH v2] Integrated Flash Controller support

From: Artem Bityutskiy
Date: Tue Nov 29 2011 - 16:37:04 EST


On Mon, 2011-10-31 at 17:38 +0800, b35362@xxxxxxxxxxxxx wrote:
> +/*
> + * fsl_ifc_ctrl_probe
> + *
> + * called by device layer when it finds a device matching
> + * one our driver can handled. This code allocates all of
> + * the resources needed for the controller only. The
> + * resources for the NAND banks themselves are allocated
> + * in the chip probe function.
> +*/
> +static int __devinit fsl_ifc_ctrl_probe(struct platform_device *dev)
> +{
> + int ret = 0;
> +
> +

... snip ...

I am concerned about the error path in this function

> + init_waitqueue_head(&fsl_ifc_ctrl_dev->nand_wait);
> +
> + ret = request_irq(fsl_ifc_ctrl_dev->irq, fsl_ifc_ctrl_irq, IRQF_SHARED,
> + "fsl-ifc", fsl_ifc_ctrl_dev);
> + if (ret != 0) {
> + dev_err(&dev->dev, "failed to install irq (%d)\n",
> + fsl_ifc_ctrl_dev->irq);
> + goto err;
> + }

irq_dispose_mapping() on error path?

> +
> + ret = request_irq(fsl_ifc_ctrl_dev->nand_irq, fsl_ifc_nand_irq, 0,
> + "fsl-ifc-nand", fsl_ifc_ctrl_dev);
> + if (ret != 0) {
> + dev_err(&dev->dev, "failed to install irq (%d)\n",
> + fsl_ifc_ctrl_dev->nand_irq);
> + goto err;

free_irq() on error path?
> + }
> +
> + return 0;
> +
> +err:
> + return ret;
> +}


> +static __init int fsl_ifc_init(void)
> +{
> + int ret;
> +
> + ret = platform_driver_register(&fsl_ifc_ctrl_driver);
> + if (ret)
> + printk(KERN_ERR "fsl-ifc: Failed to register platform"
> + "driver\n");
> +
> + return ret;
> +}
> +
> +static void __exit fsl_ifc_exit(void)
> +{
> + platform_driver_unregister(&fsl_ifc_ctrl_driver);
> +}
> +
> +module_init(fsl_ifc_init);
> +module_exit(fsl_ifc_exit);

How about using module_platform_driver() instead?


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/