diff mbox

brd: make rd_size static

Message ID 1489131159-840-1-git-send-email-yanaijie@huawei.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jason Yan March 10, 2017, 7:32 a.m. UTC
Fixes the following sparse warning:

drivers/block/brd.c:411:15: warning: symbol 'rd_size' was not declared.
Should it be static?

Signed-off-by: Jason Yan <yanaijie@huawei.com>
---
 drivers/block/brd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jens Axboe March 11, 2017, 10:29 p.m. UTC | #1
On 03/10/2017 12:32 AM, Jason Yan wrote:
> Fixes the following sparse warning:
> 
> drivers/block/brd.c:411:15: warning: symbol 'rd_size' was not declared.
> Should it be static?

If you do a search on this topic, you'll find others that attempted
to do the same. Arm uses it for tag parsing, for some reason, your
patch below would break it.

It'd be great if this was fixed up for real, though.
Jason Yan March 13, 2017, 12:56 a.m. UTC | #2
On 2017/3/12 6:29, Jens Axboe wrote:
> On 03/10/2017 12:32 AM, Jason Yan wrote:
>> Fixes the following sparse warning:
>>
>> drivers/block/brd.c:411:15: warning: symbol 'rd_size' was not declared.
>> Should it be static?
>
> If you do a search on this topic, you'll find others that attempted
> to do the same. Arm uses it for tag parsing, for some reason, your
> patch below would break it.
>
> It'd be great if this was fixed up for real, though.
>

how about fix this like this, looks ugly but works:

#ifndef CONFIG_ARM
static
#endif
Jens Axboe March 13, 2017, 2:56 a.m. UTC | #3
On 03/12/2017 06:56 PM, Jason Yan wrote:
> 
> On 2017/3/12 6:29, Jens Axboe wrote:
>> On 03/10/2017 12:32 AM, Jason Yan wrote:
>>> Fixes the following sparse warning:
>>>
>>> drivers/block/brd.c:411:15: warning: symbol 'rd_size' was not declared.
>>> Should it be static?
>>
>> If you do a search on this topic, you'll find others that attempted
>> to do the same. Arm uses it for tag parsing, for some reason, your
>> patch below would break it.
>>
>> It'd be great if this was fixed up for real, though.
>>
> 
> how about fix this like this, looks ugly but works:
> 
> #ifndef CONFIG_ARM
> static
> #endif

No, that solves nothing, and is arguably worse. Either leave it
alone, perhaps with a comment to prevent others from making the
same error, or fix it for real.
diff mbox

Patch

diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 3adc32a..e5d9f35 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -408,7 +408,7 @@  static int rd_nr = CONFIG_BLK_DEV_RAM_COUNT;
 module_param(rd_nr, int, S_IRUGO);
 MODULE_PARM_DESC(rd_nr, "Maximum number of brd devices");
 
-unsigned long rd_size = CONFIG_BLK_DEV_RAM_SIZE;
+static unsigned long rd_size = CONFIG_BLK_DEV_RAM_SIZE;
 module_param(rd_size, ulong, S_IRUGO);
 MODULE_PARM_DESC(rd_size, "Size of each RAM disk in kbytes.");