The stmfb driver is the only user of fb_of_reserve_add_fixup()
and apparently supports reserving its frame buffer when booting a kernel.
I am not sure this hand off actually works, but the very least we can
do is to avoid adding a duplicate entry repeatedly on every of_diff call.

Thus remove the old one if it exists and add a new one if the frame
buffer was enabled at fixup time.

Signed-off-by: Ahmad Fatoum <[email protected]>
---
 drivers/video/fb.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index bfc075039e9e..10d34a39e2b2 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -208,11 +208,12 @@ static int fb_of_reserve_fixup(struct device_node *root, 
void *context)
 {
        struct fb_info *info = context;
 
-       if (!info->enabled)
-               return 0;
+       of_del_reserve_entry((unsigned long)info->screen_base,
+                            (unsigned long)info->screen_base + 
info->screen_size);
 
-       of_add_reserve_entry((unsigned long)info->screen_base,
-                       (unsigned long)info->screen_base + info->screen_size);
+       if (info->enabled)
+               of_add_reserve_entry((unsigned long)info->screen_base,
+                                    (unsigned long)info->screen_base + 
info->screen_size);
 
        return 0;
 }
-- 
2.47.3


Reply via email to