diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2018-09-01 16:08:44 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2018-09-03 18:14:55 +0200 |
commit | 5fa793d36646ee313361a764eac2503d0a561a7c (patch) | |
tree | 39347b08b2c48eb96a218ac25849b6bd4ce04ee0 /drivers/video | |
parent | fbdev: show fbdev number for debugging (diff) | |
download | linux-5fa793d36646ee313361a764eac2503d0a561a7c.tar.xz linux-5fa793d36646ee313361a764eac2503d0a561a7c.zip |
fbdev: allow apertures == NULL in remove_conflicting_framebuffers()
Interpret (otherwise-invalid) NULL apertures argument to mean all-memory
range. This will allow to remove several duplicates of this code
from drivers in following patches.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/b5fed539fe569035139c8594c23effd8c39f12ca.1535810304.git.mirq-linux@rere.qmqm.pl
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/fbdev/core/fbmem.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index bd870bdc1409..21f3d31d3c2e 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1797,11 +1797,25 @@ int remove_conflicting_framebuffers(struct apertures_struct *a, const char *name, bool primary) { int ret; + bool do_free = false; + + if (!a) { + a = alloc_apertures(1); + if (!a) + return -ENOMEM; + + a->ranges[0].base = 0; + a->ranges[0].size = ~0; + do_free = true; + } mutex_lock(®istration_lock); ret = do_remove_conflicting_framebuffers(a, name, primary); mutex_unlock(®istration_lock); + if (do_free) + kfree(a); + return ret; } EXPORT_SYMBOL(remove_conflicting_framebuffers); |