drm/tilcdc: Fix the error path in tilcdc_load()
authorEzequiel Garcia <ezequiel@vanguardiasur.com.ar>
Tue, 2 Sep 2014 12:51:15 +0000 (09:51 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Nov 2014 16:59:53 +0000 (08:59 -0800)
commita2b44bbfd2e9450d87a9a482f463115b8415e356
tree9c5dd819be9eaf8c4228d6c2001a5ff08c6876e1
parent3e54c4b7e1e37a0b93782cc01749a1b4e1fc521e
drm/tilcdc: Fix the error path in tilcdc_load()

commit b478e336b3e75505707a11e78ef8b964ef0a03af upstream.

The current error path calls tilcdc_unload() in case of an error to release
the resources. However, this is wrong because not all resources have been
allocated by the time an error occurs in tilcdc_load().

To fix it, this commit adds proper labels to bail out at the different
stages in the load function, and release only the resources actually allocated.

Tested-by: Darren Etheridge <detheridge@ti.com>
Tested-by: Johannes Pointner <johannes.pointner@br-automation.com>
Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Fixes: 3a49012224ca ("drm/tilcdc: panel: fix leak when unloading the module")
Signed-off-by: Matwey V. Kornilov <matwey.kornilov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/tilcdc/tilcdc_drv.c