From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756217AbdKCMNN (ORCPT ); Fri, 3 Nov 2017 08:13:13 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:47996 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756100AbdKCMNL (ORCPT ); Fri, 3 Nov 2017 08:13:11 -0400 X-Google-Smtp-Source: ABhQp+TSqn5na/klkPJR8F5SgXah/QrAnnz3jAdF0iCxdUU8xHU7Ag8vTJytadBSKtKg00fY/l/MbB14fMKCPgexBh4= MIME-Version: 1.0 In-Reply-To: <0ed06c9aabd0f6d707f3ab8024282a764ffe0318.1509268570.git.sathyanarayanan.kuppuswamy@linux.intel.com> References: <0ed06c9aabd0f6d707f3ab8024282a764ffe0318.1509268570.git.sathyanarayanan.kuppuswamy@linux.intel.com> From: Andy Shevchenko Date: Fri, 3 Nov 2017 14:13:09 +0200 Message-ID: Subject: Re: [RFC v8 1/7] platform/x86: intel_punit_ipc: Fix resource ioremap warning To: Kuppuswamy Sathyanarayanan Cc: Alessandro Zummo , "x86@kernel.org" , Wim Van Sebroeck , Ingo Molnar , Alexandre Belloni , Zha Qipeng , "H. Peter Anvin" , "dvhart@infradead.org" , Thomas Gleixner , Lee Jones , Andy Shevchenko , Souvik Kumar Chakravarty , linux-rtc@vger.kernel.org, linux-watchdog@vger.kernel.org, "linux-kernel@vger.kernel.org" , Platform Driver , Sathyanarayanan Kuppuswamy Natarajan , Andy Shevchenko Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 29, 2017 at 11:49 AM, wrote: > From: Kuppuswamy Sathyanarayanan > > 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. I think I already told that this one had been pushed to my review and testing queue, thanks! > > Signed-off-by: Kuppuswamy Sathyanarayanan > Signed-off-by: Andy Shevchenko > --- > drivers/platform/x86/intel_punit_ipc.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > Changes since v7: > * None > > Changes since v6: > * None > > Changes since v5: > * None > > Changes since v4: > * None > > diff --git a/drivers/platform/x86/intel_punit_ipc.c b/drivers/platform/x86/intel_punit_ipc.c > index a47a41f..b5b8901 100644 > --- a/drivers/platform/x86/intel_punit_ipc.c > +++ b/drivers/platform/x86/intel_punit_ipc.c > @@ -252,28 +252,28 @@ static int intel_punit_get_bars(struct platform_device *pdev) > * - GTDRIVER_IPC BASE_IFACE > */ > res = platform_get_resource(pdev, IORESOURCE_MEM, 2); > - if (res) { > + if (res && resource_size(res) > 1) { > addr = devm_ioremap_resource(&pdev->dev, res); > if (!IS_ERR(addr)) > punit_ipcdev->base[ISPDRIVER_IPC][BASE_DATA] = addr; > } > > res = platform_get_resource(pdev, IORESOURCE_MEM, 3); > - if (res) { > + if (res && resource_size(res) > 1) { > addr = devm_ioremap_resource(&pdev->dev, res); > if (!IS_ERR(addr)) > punit_ipcdev->base[ISPDRIVER_IPC][BASE_IFACE] = addr; > } > > res = platform_get_resource(pdev, IORESOURCE_MEM, 4); > - if (res) { > + if (res && resource_size(res) > 1) { > addr = devm_ioremap_resource(&pdev->dev, res); > if (!IS_ERR(addr)) > punit_ipcdev->base[GTDRIVER_IPC][BASE_DATA] = addr; > } > > res = platform_get_resource(pdev, IORESOURCE_MEM, 5); > - if (res) { > + if (res && resource_size(res) > 1) { > addr = devm_ioremap_resource(&pdev->dev, res); > if (!IS_ERR(addr)) > punit_ipcdev->base[GTDRIVER_IPC][BASE_IFACE] = addr; > -- > 2.7.4 > -- With Best Regards, Andy Shevchenko