Commit 6cc8cbbc authored by Kuppuswamy Sathyanarayanan's avatar Kuppuswamy Sathyanarayanan Committed by Andy Shevchenko

platform/x86: intel_punit_ipc: Fix resource ioremap warning

For PUNIT device, ISPDRIVER_IPC and GTDDRIVER_IPC resources are not
mandatory. So when PMC IPC driver creates a PUNIT device, if these
resources are not available then it creates dummy resource entries for
these missing resources. But during PUNIT device probe, doing ioremap on
these dummy resources generates following warning messages.

intel_punit_ipc: can't request region for resource [mem 0x00000000]
intel_punit_ipc: can't request region for resource [mem 0x00000000]
intel_punit_ipc: can't request region for resource [mem 0x00000000]
intel_punit_ipc: can't request region for resource [mem 0x00000000]

This patch fixes this issue by adding extra check for resource size
before performing ioremap operation.
Signed-off-by: default avatarKuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent ce7ff1cf
...@@ -252,28 +252,28 @@ static int intel_punit_get_bars(struct platform_device *pdev) ...@@ -252,28 +252,28 @@ static int intel_punit_get_bars(struct platform_device *pdev)
* - GTDRIVER_IPC BASE_IFACE * - GTDRIVER_IPC BASE_IFACE
*/ */
res = platform_get_resource(pdev, IORESOURCE_MEM, 2); res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
if (res) { if (res && resource_size(res) > 1) {
addr = devm_ioremap_resource(&pdev->dev, res); addr = devm_ioremap_resource(&pdev->dev, res);
if (!IS_ERR(addr)) if (!IS_ERR(addr))
punit_ipcdev->base[ISPDRIVER_IPC][BASE_DATA] = addr; punit_ipcdev->base[ISPDRIVER_IPC][BASE_DATA] = addr;
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, 3); res = platform_get_resource(pdev, IORESOURCE_MEM, 3);
if (res) { if (res && resource_size(res) > 1) {
addr = devm_ioremap_resource(&pdev->dev, res); addr = devm_ioremap_resource(&pdev->dev, res);
if (!IS_ERR(addr)) if (!IS_ERR(addr))
punit_ipcdev->base[ISPDRIVER_IPC][BASE_IFACE] = addr; punit_ipcdev->base[ISPDRIVER_IPC][BASE_IFACE] = addr;
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, 4); res = platform_get_resource(pdev, IORESOURCE_MEM, 4);
if (res) { if (res && resource_size(res) > 1) {
addr = devm_ioremap_resource(&pdev->dev, res); addr = devm_ioremap_resource(&pdev->dev, res);
if (!IS_ERR(addr)) if (!IS_ERR(addr))
punit_ipcdev->base[GTDRIVER_IPC][BASE_DATA] = addr; punit_ipcdev->base[GTDRIVER_IPC][BASE_DATA] = addr;
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, 5); res = platform_get_resource(pdev, IORESOURCE_MEM, 5);
if (res) { if (res && resource_size(res) > 1) {
addr = devm_ioremap_resource(&pdev->dev, res); addr = devm_ioremap_resource(&pdev->dev, res);
if (!IS_ERR(addr)) if (!IS_ERR(addr))
punit_ipcdev->base[GTDRIVER_IPC][BASE_IFACE] = addr; punit_ipcdev->base[GTDRIVER_IPC][BASE_IFACE] = addr;
......
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