# \[PATCH v1\] video: fbdev: sm712fb: fix an issue about iounmap for a wrong address

- Subsystems: FRAMEBUFFER LAYER, SILICON MOTION SM712 FRAME BUFFER DRIVER, THE REST
- Maintainers: Helge Deller, Sudip Mukherjee, Teddy Wang, Sudip Mukherjee, Linus Torvalds
- Status: LANDED (98bd4f729886 · 2020-06-01 13:15)
- Landed in mainline as 98bd4f729886 on 2020-06-01.
- List: linux-fbdev
- 2 messages, 2 authors
- Page: https://ratatoskr.run/linux-fbdev/2020/04/5938513/t

## \[PATCH v1\] video: fbdev: sm712fb: fix an issue about iounmap for a wrong address

- From: Dejin Zheng \<hidden\>
- Date: 2020-04-22 16:07:29 
- Message: https://ratatoskr.run/linux-fbdev/2020/04/5938513.md

```text
the sfb->fb->screen_base is not save the value get by iounmap() when
the chip id is 0x720. so iounmap() for address sfb->fb->screen_base
is not right.

Fixes: 1461d6672864854 ("staging: sm7xxfb: merge sm712fb with fbdev")
CC: Andy Shevchenko <redacted>
Signed-off-by: Dejin Zheng <redacted>
---
 drivers/video/fbdev/sm712fb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/video/fbdev/sm712fb.c b/drivers/video/fbdev/sm712fb.c
index 6a1b4a853d9e..8cd655d6d628 100644
--- a/drivers/video/fbdev/sm712fb.c
+++ b/drivers/video/fbdev/sm712fb.c
@@ -1429,6 +1429,8 @@ static int smtc_map_smem(struct smtcfb_info *sfb,
 static void smtc_unmap_smem(struct smtcfb_info *sfb)
 {
 	if (sfb && sfb->fb->screen_base) {
+		if (sfb->chip_id = 0x720)
+			sfb->fb->screen_base -= 0x00200000;
 		iounmap(sfb->fb->screen_base);
 		sfb->fb->screen_base = NULL;
 	}
-- 
2.25.0
```

## Re: \[PATCH v1\] video: fbdev: sm712fb: fix an issue about iounmap for a wrong address

- From: Bartlomiej Zolnierkiewicz \<hidden\>
- Date: 2020-06-01 13:25:15 
- Message: https://ratatoskr.run/linux-fbdev/2020/06/5985451.md

```text

On 4/22/20 6:07 PM, Dejin Zheng wrote:
> the sfb->fb->screen_base is not save the value get by iounmap() when
> the chip id is 0x720. so iounmap() for address sfb->fb->screen_base
> is not right.
> 
> Fixes: 1461d6672864854 ("staging: sm7xxfb: merge sm712fb with fbdev")
> CC: Andy Shevchenko <redacted>
> Signed-off-by: Dejin Zheng <redacted>

Applied to drm-misc-next tree (patch should show up in v5.9), thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

> ---
>  drivers/video/fbdev/sm712fb.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/video/fbdev/sm712fb.c b/drivers/video/fbdev/sm712fb.c
> index 6a1b4a853d9e..8cd655d6d628 100644
> --- a/drivers/video/fbdev/sm712fb.c
> +++ b/drivers/video/fbdev/sm712fb.c
> @@ -1429,6 +1429,8 @@ static int smtc_map_smem(struct smtcfb_info *sfb,
>  static void smtc_unmap_smem(struct smtcfb_info *sfb)
>  {
>  	if (sfb && sfb->fb->screen_base) {
> +		if (sfb->chip_id = 0x720)
> +			sfb->fb->screen_base -= 0x00200000;
>  		iounmap(sfb->fb->screen_base);
>  		sfb->fb->screen_base = NULL;
>  	}
> 
```
