summaryrefslogtreecommitdiff
path: root/drivers/video/sh_mobile_lcdcfb.c
diff options
context:
space:
mode:
authorAlexandre Courbot <gnurou@gmail.com>2011-02-23 08:41:50 +0000
committerPaul Mundt <lethal@linux-sh.org>2011-03-29 16:04:45 +0900
commit247f99386100d1d1c369ba98120d2edebf5426fc (patch)
treea2cfbacd57e3578c3e503d1ff31bde6829652cd0 /drivers/video/sh_mobile_lcdcfb.c
parent8857b9aa7e64a70852545ee01fa638481cb08a76 (diff)
fbdev: sh_mobile_lcdcfb: fix module lock acquisition
Whenever the LCDC is to be started or stopped, a board callback is checked for existence and invoked. Prior to the invokation, the callback's module lock is also acquired, to be released once the callback returns. However, the order of testing makes it possible for the lock to be acquired and not released in case the callback does not exist. This patch reorders the tests to prevent this particular case. Signed-off-by: Alexandre Courbot <gnurou@gmail.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/video/sh_mobile_lcdcfb.c')
-rw-r--r--drivers/video/sh_mobile_lcdcfb.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index 65c4ee3628c..69e2833bd46 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -616,7 +616,7 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
continue;
board_cfg = &ch->cfg.board_cfg;
- if (try_module_get(board_cfg->owner) && board_cfg->display_on) {
+ if (board_cfg->display_on && try_module_get(board_cfg->owner)) {
board_cfg->display_on(board_cfg->board_data, ch->info);
module_put(board_cfg->owner);
}
@@ -661,7 +661,7 @@ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv)
}
board_cfg = &ch->cfg.board_cfg;
- if (try_module_get(board_cfg->owner) && board_cfg->display_off) {
+ if (board_cfg->display_off && try_module_get(board_cfg->owner)) {
board_cfg->display_off(board_cfg->board_data);
module_put(board_cfg->owner);
}
@@ -1228,7 +1228,7 @@ static int sh_mobile_lcdc_notify(struct notifier_block *nb,
switch(action) {
case FB_EVENT_SUSPEND:
- if (try_module_get(board_cfg->owner) && board_cfg->display_off) {
+ if (board_cfg->display_off && try_module_get(board_cfg->owner)) {
board_cfg->display_off(board_cfg->board_data);
module_put(board_cfg->owner);
}
@@ -1241,7 +1241,7 @@ static int sh_mobile_lcdc_notify(struct notifier_block *nb,
mutex_unlock(&ch->open_lock);
/* HDMI must be enabled before LCDC configuration */
- if (try_module_get(board_cfg->owner) && board_cfg->display_on) {
+ if (board_cfg->display_on && try_module_get(board_cfg->owner)) {
board_cfg->display_on(board_cfg->board_data, info);
module_put(board_cfg->owner);
}