mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-11-30 15:53:22 -05:00
video: fbdev: w100fb: Reset global state
[ Upstream commit 8738ddcac644964ae128ccd3d80d48773c8d528e ] 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: Evgeny Novikov <[email protected]> Co-developed-by: Kirill Shilimanov <[email protected]> Signed-off-by: Kirill Shilimanov <[email protected]> Signed-off-by: Helge Deller <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
This commit is contained in:
parent
055cdd2e7b
commit
b19c7df304
1 changed files with 12 additions and 3 deletions
|
|
@ -770,12 +770,18 @@ out:
|
|||
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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue