Commit 8738ddca authored by Evgeny Novikov's avatar Evgeny Novikov Committed by Helge Deller

video: fbdev: w100fb: Reset global state

w100fb_probe() did not reset the global state to its initial state. This
can result in invocation of iounmap() even when there was not the
appropriate successful call of ioremap(). For instance, this may be the
case if first probe fails after two successful ioremap() while second
probe fails when first ioremap() fails. The similar issue is with
w100fb_remove(). The patch fixes both bugs.

Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: default avatarEvgeny Novikov <novikov@ispras.ru>
Co-developed-by: default avatarKirill Shilimanov <kirill.shilimanov@huawei.com>
Signed-off-by: default avatarKirill Shilimanov <kirill.shilimanov@huawei.com>
Signed-off-by: default avatarHelge Deller <deller@gmx.de>
parent 212efde8
......@@ -770,12 +770,18 @@ static int w100fb_probe(struct platform_device *pdev)
fb_dealloc_cmap(&info->cmap);
kfree(info->pseudo_palette);
}
if (remapped_fbuf != NULL)
if (remapped_fbuf != NULL) {
iounmap(remapped_fbuf);
if (remapped_regs != NULL)
remapped_fbuf = NULL;
}
if (remapped_regs != NULL) {
iounmap(remapped_regs);
if (remapped_base != NULL)
remapped_regs = NULL;
}
if (remapped_base != NULL) {
iounmap(remapped_base);
remapped_base = NULL;
}
if (info)
framebuffer_release(info);
return err;
......@@ -795,8 +801,11 @@ static int w100fb_remove(struct platform_device *pdev)
fb_dealloc_cmap(&info->cmap);
iounmap(remapped_base);
remapped_base = NULL;
iounmap(remapped_regs);
remapped_regs = NULL;
iounmap(remapped_fbuf);
remapped_fbuf = NULL;
framebuffer_release(info);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment