linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* drivers/cxl/pci.c:439:7: warning: Local variable 'rc' shadows outer variable [shadowVariable]
@ 2022-04-02 11:26 kernel test robot
  2022-04-03 19:29 ` Randy Dunlap
  0 siblings, 1 reply; 6+ messages in thread
From: kernel test robot @ 2022-04-02 11:26 UTC (permalink / raw)
  To: Ben Widawsky; +Cc: kbuild-all, linux-kernel, Dan Williams, Jonathan Cameron

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   88e6c0207623874922712e162e25d9dafd39661e
commit: 523e594d9cc03db962c741ce02c8a58aab58a123 cxl/pci: Implement wait for media active
date:   7 weeks ago
compiler: alpha-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


cppcheck warnings: (new ones prefixed by >>)
>> drivers/cxl/pci.c:439:7: warning: Local variable 'rc' shadows outer variable [shadowVariable]
     int rc;
         ^
   drivers/cxl/pci.c:431:6: note: Shadowed declaration
    int rc, i;
        ^
   drivers/cxl/pci.c:439:7: note: Shadow variable
     int rc;
         ^

cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> drivers/cxl/port.c:63:1: warning: There is an unknown macro here somewhere. Configuration is required. If __stringify is a macro then please configure it. [unknownMacro]
   MODULE_ALIAS_CXL(CXL_DEVICE_PORT);
   ^
--

vim +/rc +439 drivers/cxl/pci.c

   420	
   421	/*
   422	 * Wait up to @mbox_ready_timeout for the device to report memory
   423	 * active.
   424	 */
   425	static int wait_for_media_ready(struct cxl_dev_state *cxlds)
   426	{
   427		struct pci_dev *pdev = to_pci_dev(cxlds->dev);
   428		int d = cxlds->cxl_dvsec;
   429		bool active = false;
   430		u64 md_status;
   431		int rc, i;
   432	
   433		rc = wait_for_valid(cxlds);
   434		if (rc)
   435			return rc;
   436	
   437		for (i = mbox_ready_timeout; i; i--) {
   438			u32 temp;
 > 439			int rc;
   440	
   441			rc = pci_read_config_dword(
   442				pdev, d + CXL_DVSEC_RANGE_SIZE_LOW(0), &temp);
   443			if (rc)
   444				return rc;
   445	
   446			active = FIELD_GET(CXL_DVSEC_MEM_ACTIVE, temp);
   447			if (active)
   448				break;
   449			msleep(1000);
   450		}
   451	
   452		if (!active) {
   453			dev_err(&pdev->dev,
   454				"timeout awaiting memory active after %d seconds\n",
   455				mbox_ready_timeout);
   456			return -ETIMEDOUT;
   457		}
   458	
   459		md_status = readq(cxlds->regs.memdev + CXLMDEV_STATUS_OFFSET);
   460		if (!CXLMDEV_READY(md_status))
   461			return -EIO;
   462	
   463		return 0;
   464	}
   465	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: drivers/cxl/pci.c:439:7: warning: Local variable 'rc' shadows outer variable [shadowVariable]
  2022-04-02 11:26 drivers/cxl/pci.c:439:7: warning: Local variable 'rc' shadows outer variable [shadowVariable] kernel test robot
@ 2022-04-03 19:29 ` Randy Dunlap
  2022-04-06 11:17   ` [kbuild-all] " Chen, Rong A
  0 siblings, 1 reply; 6+ messages in thread
From: Randy Dunlap @ 2022-04-03 19:29 UTC (permalink / raw)
  To: kernel test robot, Ben Widawsky
  Cc: kbuild-all, linux-kernel, Dan Williams, Jonathan Cameron

Hi lkp/ktr,

On 4/2/22 04:26, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   88e6c0207623874922712e162e25d9dafd39661e
> commit: 523e594d9cc03db962c741ce02c8a58aab58a123 cxl/pci: Implement wait for media active
> date:   7 weeks ago
> compiler: alpha-linux-gcc (GCC) 11.2.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> 
> cppcheck warnings: (new ones prefixed by >>)
>>> drivers/cxl/pci.c:439:7: warning: Local variable 'rc' shadows outer variable [shadowVariable]
>      int rc;
>          ^
>    drivers/cxl/pci.c:431:6: note: Shadowed declaration
>     int rc, i;
>         ^
>    drivers/cxl/pci.c:439:7: note: Shadow variable
>      int rc;
>          ^
> 
> cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
> 
>>> drivers/cxl/port.c:63:1: warning: There is an unknown macro here somewhere. Configuration is required. If __stringify is a macro then please configure it. [unknownMacro]
>    MODULE_ALIAS_CXL(CXL_DEVICE_PORT);
>    ^
> --

Can you provide a cppcheck config file and command line
for this, please?

My naive testing does not see any of these warnings --
although I can easily spot the problems in the source file.

thanks.
-- 
~Randy

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [kbuild-all] Re: drivers/cxl/pci.c:439:7: warning: Local variable 'rc' shadows outer variable [shadowVariable]
  2022-04-03 19:29 ` Randy Dunlap
@ 2022-04-06 11:17   ` Chen, Rong A
  2022-04-07  0:11     ` Randy Dunlap
  0 siblings, 1 reply; 6+ messages in thread
From: Chen, Rong A @ 2022-04-06 11:17 UTC (permalink / raw)
  To: Randy Dunlap, kernel test robot, Ben Widawsky
  Cc: kbuild-all, linux-kernel, Dan Williams, Jonathan Cameron



On 4/4/2022 3:29 AM, Randy Dunlap wrote:
> Hi lkp/ktr,
> 
> On 4/2/22 04:26, kernel test robot wrote:
>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> head:   88e6c0207623874922712e162e25d9dafd39661e
>> commit: 523e594d9cc03db962c741ce02c8a58aab58a123 cxl/pci: Implement wait for media active
>> date:   7 weeks ago
>> compiler: alpha-linux-gcc (GCC) 11.2.0
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <lkp@intel.com>
>>
>>
>> cppcheck warnings: (new ones prefixed by >>)
>>>> drivers/cxl/pci.c:439:7: warning: Local variable 'rc' shadows outer variable [shadowVariable]
>>       int rc;
>>           ^
>>     drivers/cxl/pci.c:431:6: note: Shadowed declaration
>>      int rc, i;
>>          ^
>>     drivers/cxl/pci.c:439:7: note: Shadow variable
>>       int rc;
>>           ^
>>
>> cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>>
>>>> drivers/cxl/port.c:63:1: warning: There is an unknown macro here somewhere. Configuration is required. If __stringify is a macro then please configure it. [unknownMacro]
>>     MODULE_ALIAS_CXL(CXL_DEVICE_PORT);
>>     ^
>> --
> 
> Can you provide a cppcheck config file and command line
> for this, please?

Hi Randy,

The below command can show the warning:
$ cppcheck --quiet --enable=style,performance,portability --template=gcc 
drivers/cxl/port.c
drivers/cxl/port.c:63:1: warning: There is an unknown macro here 
somewhere. Configuration is required. If __stringify is a macro then 
please configure it. [unknownMacro]
MODULE_ALIAS_CXL(CXL_DEVICE_PORT);
^

Best Regards,
Rong Chen

> 
> My naive testing does not see any of these warnings --
> although I can easily spot the problems in the source file.
> 
> thanks.
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [kbuild-all] Re: drivers/cxl/pci.c:439:7: warning: Local variable 'rc' shadows outer variable [shadowVariable]
  2022-04-06 11:17   ` [kbuild-all] " Chen, Rong A
@ 2022-04-07  0:11     ` Randy Dunlap
  2022-04-08  3:34       ` Chen, Rong A
  0 siblings, 1 reply; 6+ messages in thread
From: Randy Dunlap @ 2022-04-07  0:11 UTC (permalink / raw)
  To: Chen, Rong A, kernel test robot, Ben Widawsky
  Cc: kbuild-all, linux-kernel, Dan Williams, Jonathan Cameron



On 4/6/22 04:17, Chen, Rong A wrote:
> 
> 
> On 4/4/2022 3:29 AM, Randy Dunlap wrote:
>> Hi lkp/ktr,
>>
>> On 4/2/22 04:26, kernel test robot wrote:
>>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>>> head:   88e6c0207623874922712e162e25d9dafd39661e
>>> commit: 523e594d9cc03db962c741ce02c8a58aab58a123 cxl/pci: Implement wait for media active
>>> date:   7 weeks ago
>>> compiler: alpha-linux-gcc (GCC) 11.2.0
>>>
>>> If you fix the issue, kindly add following tag as appropriate
>>> Reported-by: kernel test robot <lkp@intel.com>
>>>
>>>
>>> cppcheck warnings: (new ones prefixed by >>)
>>>>> drivers/cxl/pci.c:439:7: warning: Local variable 'rc' shadows outer variable [shadowVariable]
>>>       int rc;
>>>           ^
>>>     drivers/cxl/pci.c:431:6: note: Shadowed declaration
>>>      int rc, i;
>>>          ^
>>>     drivers/cxl/pci.c:439:7: note: Shadow variable
>>>       int rc;
>>>           ^
>>>
>>> cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>>>
>>>>> drivers/cxl/port.c:63:1: warning: There is an unknown macro here somewhere. Configuration is required. If __stringify is a macro then please configure it. [unknownMacro]
>>>     MODULE_ALIAS_CXL(CXL_DEVICE_PORT);
>>>     ^
>>> -- 
>>
>> Can you provide a cppcheck config file and command line
>> for this, please?
> 
> Hi Randy,
> 
> The below command can show the warning:
> $ cppcheck --quiet --enable=style,performance,portability --template=gcc drivers/cxl/port.c
> drivers/cxl/port.c:63:1: warning: There is an unknown macro here somewhere. Configuration is required. If __stringify is a macro then please configure it. [unknownMacro]
> MODULE_ALIAS_CXL(CXL_DEVICE_PORT);
> ^

Hm, that still shows me nothing. There must be something else.
Maybe it's version-related?  I have:

$ cppcheck --version
Cppcheck 1.82

> 
> Best Regards,
> Rong Chen
> 
>>
>> My naive testing does not see any of these warnings --
>> although I can easily spot the problems in the source file.
>>
>> thanks.

thanks.

-- 
~Randy

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [kbuild-all] Re: drivers/cxl/pci.c:439:7: warning: Local variable 'rc' shadows outer variable [shadowVariable]
  2022-04-07  0:11     ` Randy Dunlap
@ 2022-04-08  3:34       ` Chen, Rong A
  2022-04-08  4:37         ` Randy Dunlap
  0 siblings, 1 reply; 6+ messages in thread
From: Chen, Rong A @ 2022-04-08  3:34 UTC (permalink / raw)
  To: Randy Dunlap, kernel test robot, Ben Widawsky
  Cc: kbuild-all, linux-kernel, Dan Williams, Jonathan Cameron



On 4/7/2022 8:11 AM, Randy Dunlap wrote:
> 
> 
> On 4/6/22 04:17, Chen, Rong A wrote:
>>
>>
>> On 4/4/2022 3:29 AM, Randy Dunlap wrote:
>>> Hi lkp/ktr,
>>>
>>> On 4/2/22 04:26, kernel test robot wrote:
>>>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>>>> head:   88e6c0207623874922712e162e25d9dafd39661e
>>>> commit: 523e594d9cc03db962c741ce02c8a58aab58a123 cxl/pci: Implement wait for media active
>>>> date:   7 weeks ago
>>>> compiler: alpha-linux-gcc (GCC) 11.2.0
>>>>
>>>> If you fix the issue, kindly add following tag as appropriate
>>>> Reported-by: kernel test robot <lkp@intel.com>
>>>>
>>>>
>>>> cppcheck warnings: (new ones prefixed by >>)
>>>>>> drivers/cxl/pci.c:439:7: warning: Local variable 'rc' shadows outer variable [shadowVariable]
>>>>        int rc;
>>>>            ^
>>>>      drivers/cxl/pci.c:431:6: note: Shadowed declaration
>>>>       int rc, i;
>>>>           ^
>>>>      drivers/cxl/pci.c:439:7: note: Shadow variable
>>>>        int rc;
>>>>            ^
>>>>
>>>> cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>>>>
>>>>>> drivers/cxl/port.c:63:1: warning: There is an unknown macro here somewhere. Configuration is required. If __stringify is a macro then please configure it. [unknownMacro]
>>>>      MODULE_ALIAS_CXL(CXL_DEVICE_PORT);
>>>>      ^
>>>> -- 
>>>
>>> Can you provide a cppcheck config file and command line
>>> for this, please?
>>
>> Hi Randy,
>>
>> The below command can show the warning:
>> $ cppcheck --quiet --enable=style,performance,portability --template=gcc drivers/cxl/port.c
>> drivers/cxl/port.c:63:1: warning: There is an unknown macro here somewhere. Configuration is required. If __stringify is a macro then please configure it. [unknownMacro]
>> MODULE_ALIAS_CXL(CXL_DEVICE_PORT);
>> ^
> 
> Hm, that still shows me nothing. There must be something else.
> Maybe it's version-related?  I have:

Hi Randy,

I'm using version 2.3:

$ cppcheck --version
Cppcheck 2.3

and I can't see the warning too if using Cppcheck 1.86.

Best Regards,
Rong Chen

> 
> $ cppcheck --version
> Cppcheck 1.82
> 
>>
>> Best Regards,
>> Rong Chen
>>
>>>
>>> My naive testing does not see any of these warnings --
>>> although I can easily spot the problems in the source file.
>>>
>>> thanks.
> 
> thanks.
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [kbuild-all] Re: drivers/cxl/pci.c:439:7: warning: Local variable 'rc' shadows outer variable [shadowVariable]
  2022-04-08  3:34       ` Chen, Rong A
@ 2022-04-08  4:37         ` Randy Dunlap
  0 siblings, 0 replies; 6+ messages in thread
From: Randy Dunlap @ 2022-04-08  4:37 UTC (permalink / raw)
  To: Chen, Rong A, kernel test robot, Ben Widawsky
  Cc: kbuild-all, linux-kernel, Dan Williams, Jonathan Cameron



On 4/7/22 20:34, Chen, Rong A wrote:
> 
> 
> On 4/7/2022 8:11 AM, Randy Dunlap wrote:
>>
>>
>> On 4/6/22 04:17, Chen, Rong A wrote:
>>>
>>>
>>> On 4/4/2022 3:29 AM, Randy Dunlap wrote:
>>>> Hi lkp/ktr,
>>>>
>>>> On 4/2/22 04:26, kernel test robot wrote:
>>>>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>>>>> head:   88e6c0207623874922712e162e25d9dafd39661e
>>>>> commit: 523e594d9cc03db962c741ce02c8a58aab58a123 cxl/pci: Implement wait for media active
>>>>> date:   7 weeks ago
>>>>> compiler: alpha-linux-gcc (GCC) 11.2.0
>>>>>
>>>>> If you fix the issue, kindly add following tag as appropriate
>>>>> Reported-by: kernel test robot <lkp@intel.com>
>>>>>
>>>>>
>>>>> cppcheck warnings: (new ones prefixed by >>)
>>>>>>> drivers/cxl/pci.c:439:7: warning: Local variable 'rc' shadows outer variable [shadowVariable]
>>>>>        int rc;
>>>>>            ^
>>>>>      drivers/cxl/pci.c:431:6: note: Shadowed declaration
>>>>>       int rc, i;
>>>>>           ^
>>>>>      drivers/cxl/pci.c:439:7: note: Shadow variable
>>>>>        int rc;
>>>>>            ^
>>>>>
>>>>> cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>>>>>
>>>>>>> drivers/cxl/port.c:63:1: warning: There is an unknown macro here somewhere. Configuration is required. If __stringify is a macro then please configure it. [unknownMacro]
>>>>>      MODULE_ALIAS_CXL(CXL_DEVICE_PORT);
>>>>>      ^
>>>>> -- 
>>>>
>>>> Can you provide a cppcheck config file and command line
>>>> for this, please?
>>>
>>> Hi Randy,
>>>
>>> The below command can show the warning:
>>> $ cppcheck --quiet --enable=style,performance,portability --template=gcc drivers/cxl/port.c
>>> drivers/cxl/port.c:63:1: warning: There is an unknown macro here somewhere. Configuration is required. If __stringify is a macro then please configure it. [unknownMacro]
>>> MODULE_ALIAS_CXL(CXL_DEVICE_PORT);
>>> ^
>>
>> Hm, that still shows me nothing. There must be something else.
>> Maybe it's version-related?  I have:
> 
> Hi Randy,
> 
> I'm using version 2.3:
> 
> $ cppcheck --version
> Cppcheck 2.3
> 
> and I can't see the warning too if using Cppcheck 1.86.
> 
> Best Regards,
> Rong Chen

Hi Rong,

I downloaded version  2.7 and I can see the warnings now.

Thanks!

>>
>> $ cppcheck --version
>> Cppcheck 1.82
>>
>>>
>>> Best Regards,
>>> Rong Chen
>>>
>>>>
>>>> My naive testing does not see any of these warnings --
>>>> although I can easily spot the problems in the source file.
>>>>
>>>> thanks.
>>
>> thanks.
>>

-- 
~Randy

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-04-08  4:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-02 11:26 drivers/cxl/pci.c:439:7: warning: Local variable 'rc' shadows outer variable [shadowVariable] kernel test robot
2022-04-03 19:29 ` Randy Dunlap
2022-04-06 11:17   ` [kbuild-all] " Chen, Rong A
2022-04-07  0:11     ` Randy Dunlap
2022-04-08  3:34       ` Chen, Rong A
2022-04-08  4:37         ` Randy Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).