On Thu, Apr 19, 2012 at 11:41:34AM +0900, MyungJoo Ham wrote: > The generic GPIO extcon driver (an external connector device based on > GPIO control) and imported from Android kernel. Reviwed-by: Mark Brown > + ret = gpio_request(extcon_data->gpio, pdev->name); > + if (ret < 0) > + goto err_request_gpio; > + > + ret = gpio_direction_input(extcon_data->gpio); > + if (ret < 0) > + goto err_set_gpio_input; Incrementally (or in future versions) I'd suggest replacing with gpio_request_one() which combines the above and is generally nicer. > +static int __devexit gpio_extcon_remove(struct platform_device *pdev) > +{ > + struct gpio_extcon_data *extcon_data = platform_get_drvdata(pdev); > + > + cancel_delayed_work_sync(&extcon_data->work); > + gpio_free(extcon_data->gpio); > + extcon_dev_unregister(&extcon_data->edev); > + devm_kfree(&pdev->dev, extcon_data); The whole point of using devm_ is that you don't need to explicitly free for this usage pattern. On the other hand it does no harm.