Commit 448aaf54 authored by Hardik Phalet's avatar Hardik Phalet Committed by Helge Deller
Browse files

fbdev: hgafb: Request memory region before ioremap



The driver calls ioremap() on the HGA video memory at 0xb0000 without
first reserving the physical address range. This leaves the kernel
resource tree incomplete and can cause silent conflicts with other
drivers claiming the same range.

Add a devm_request_mem_region() call before ioremap() in
hga_card_detect() to reserve the memory region.

Signed-off-by: default avatarHardik Phalet <hardik.phalet@pm.me>
Reviewed-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: default avatarHelge Deller <deller@gmx.de>
parent a40c0e81
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -276,7 +276,7 @@ static void hga_blank(int blank_mode)
	spin_unlock_irqrestore(&hga_reg_lock, flags);
}

static int hga_card_detect(void)
static int hga_card_detect(struct platform_device *pdev)
{
	int count = 0;
	void __iomem *p, *q;
@@ -284,6 +284,11 @@ static int hga_card_detect(void)

	hga_vram_len  = 0x08000;

	if (!devm_request_mem_region(&pdev->dev, 0xb0000, hga_vram_len, "hgafb")) {
		dev_err(&pdev->dev, "cannot reserve video memory at 0xb0000\n");
		return -EBUSY;
	}

	hga_vram = ioremap(0xb0000, hga_vram_len);
	if (!hga_vram)
		return -ENOMEM;
@@ -568,7 +573,7 @@ static int hgafb_probe(struct platform_device *pdev)
	struct fb_info *info;
	int ret;

	ret = hga_card_detect();
	ret = hga_card_detect(pdev);
	if (ret)
		return ret;