Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: sm750fb: Call iounmap() to free mapped bus memory

If ioremap_wc() fails, the code jumps to the "exit" label and forgets to
free the bus memory mapped into "sm750_dev->pvReg". Mapped bus memory must
always be freed by calling iounmap().

Call iounmap(sm750_dev->pvReg) when the above-mentioned failures happen.

The site of the missing iounmap() has been detected by Smatch.

Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Link: https://lore.kernel.org/r/20220402175655.31512-1-fmdefrancesco@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Fabio M. De Francesco and committed by
Greg Kroah-Hartman
aaec586a c9736770

+1
+1
drivers/staging/sm750fb/sm750_hw.c
··· 81 81 sm750_dev->pvMem = 82 82 ioremap_wc(sm750_dev->vidmem_start, sm750_dev->vidmem_size); 83 83 if (!sm750_dev->pvMem) { 84 + iounmap(sm750_dev->pvReg); 84 85 pr_err("Map video memory failed\n"); 85 86 ret = -EFAULT; 86 87 goto exit;