diff options
author | Ben Dooks <ben-linux@fluff.org> | 2008-11-19 15:36:25 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-11-19 18:49:58 -0800 |
commit | b3b4dc8840a8fdbe495723d35cd976d781fd42fa (patch) | |
tree | 4cacf1e1b4c4f71906ff888bcf2b0acc4022bf3c /drivers/video/backlight | |
parent | c267fd777a478d74fa8959628538b64088f67fd2 (diff) | |
download | linux-b3b4dc8840a8fdbe495723d35cd976d781fd42fa.tar.gz linux-b3b4dc8840a8fdbe495723d35cd976d781fd42fa.tar.bz2 linux-b3b4dc8840a8fdbe495723d35cd976d781fd42fa.zip |
lcd: fix oops if driver only interested in .set_power
The LCD driver core calls LCD drivers when either the blanking state or
the display mode has changed, but does not make any check to see if the
called driver has a .set_mode method.
This means if a driver only has a .set_power method then the system will
OOPS on changing mode (and with the console semaphore held so you cannot
easily see the problem).
Fix the problem by ensuring that either callback is valid before use.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/backlight')
-rw-r--r-- | drivers/video/backlight/lcd.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c index 8e1731d3b228..680e57b616cd 100644 --- a/drivers/video/backlight/lcd.c +++ b/drivers/video/backlight/lcd.c @@ -42,10 +42,13 @@ static int fb_notifier_callback(struct notifier_block *self, mutex_lock(&ld->ops_lock); if (!ld->ops->check_fb || ld->ops->check_fb(ld, evdata->info)) { - if (event == FB_EVENT_BLANK) - ld->ops->set_power(ld, *(int *)evdata->data); - else - ld->ops->set_mode(ld, evdata->data); + if (event == FB_EVENT_BLANK) { + if (ld->ops->set_power) + ld->ops->set_power(ld, *(int *)evdata->data); + } else { + if (ld->ops->set_mode) + ld->ops->set_mode(ld, evdata->data); + } } mutex_unlock(&ld->ops_lock); return 0; |