PM / Hibernate: hibernation_ops->leave should be checked too
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Fri, 26 Nov 2010 22:07:48 +0000 (23:07 +0100)
committerRafael J. Wysocki <rjw@sisk.pl>
Fri, 24 Dec 2010 14:02:40 +0000 (15:02 +0100)
Because hibernate calls hibernation_ops->leave() without checking
whether hibernation_ops->leave is NULL or not, hiberantion_set_ops
should WARN_ON if hibernation_ops->leave is NULL.

This patch added one more condition to check hibernation_ops->leave.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
kernel/power/hibernate.c

index 048d0b5..ab2836c 100644 (file)
@@ -62,7 +62,7 @@ void hibernation_set_ops(struct platform_hibernation_ops *ops)
 {
        if (ops && !(ops->begin && ops->end &&  ops->pre_snapshot
            && ops->prepare && ops->finish && ops->enter && ops->pre_restore
-           && ops->restore_cleanup)) {
+           && ops->restore_cleanup && ops->leave)) {
                WARN_ON(1);
                return;
        }