From: Chanwoo Choi Date: Fri, 9 May 2014 07:43:07 +0000 (+0900) Subject: PM / devfreq: Fix devfreq_remove_device() to improve the sequence of resource free X-Git-Tag: omap-for-v3.16/fixes-against-rc1~39^2~5^2~2^2^2~5 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=585fc83ece43be63d5775e536f855db33dd752cf;p=pandora-kernel.git PM / devfreq: Fix devfreq_remove_device() to improve the sequence of resource free This patch modify devfreq_remove_device() to improve the sequence of resource free. If executing existing devfreq_remove_device(), this function always executes _remove_devfreq() twice. In result, second _remove_devfreq() always return error value. So, This patch resolves complicated function sequence as following: [Flow sequence before modification] devfreq_remove_device() _remove_devfreq(devfreq, false) kfree(devfreq); /* Free devfreq */ if (!skip ...) { /* skip is false */ device_unregister(&devfreq->dev) put_device(&devfreq->dev); ... dev->release() devfreq_dev_release() _remove_devfreq(devfreq, true) <- Recall to free devfreq /* * Always return error without freeing resource because * already _remove_devfreq() frees the memory of devfreq. */ } [Flow sequence after modification] devfreq_remove_device device_unregister(&devfreq->dev) put_device(&devfreq->dev); .. dev->release() devfreq_dev_release() _remove_devfreq() kfree(devfreq); /* Free devfreq */ Signed-off-by: Chanwoo Choi [Merge conflict resolved by MyungJoo] Signed-off-by: MyungJoo Ham --- Reading git-diff-tree failed