Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1639819

Re: [PATCH 2/2] of: reserved_mem: fix 'const' annotation

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] of: reserved_mem: fix 'const' annotation
Date Thu, 11 May 2017 18:00:04 +0200
Message-ID <tFYFu-8gi-69@gated-at.bofh.it> (permalink)
References <tFVod-6fr-3@gated-at.bofh.it> <tFVod-6fr-1@gated-at.bofh.it> <tFXJn-7DY-15@gated-at.bofh.it>
X-Original-To Rob Herring <robh+dt@kernel.org>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=ap3Ak6LBHt4XChQ6WZEvlOCSG2QPiUd68ueTeR9q3D0=; b=bq6cLNXv19/3O03waw7RkV3c6bJFQ2g2mwVw3n1Az0ZDHMnOz5eGuK4a9Bc79yEUu5 JOz0UYGXuBg9DxtNAfm244kFLuk1vw3uoykcfhxUXIAABVsSe1Iqi17xIjH2cNGRSTX0 p58MQihmmh+D1Drsfwe82jxcrUQtIOszZCwpqkRIG6Aw2ok7lXjfHGh5J/iaiTj3++tQ 2G9VzshMoaM27GFp/l/O8noJQ14ygkXw8jOQ3z3ddkitTW//XCkh+UD/0NTZkHSuPrsw 2OuXJZCcbOstoSx8gw+oBwfWdKQcu0hlX5CtNMiAxWdAq20hwl2bD+FD+t0Jd8OMwgDi Kwcw==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=ap3Ak6LBHt4XChQ6WZEvlOCSG2QPiUd68ueTeR9q3D0=; b=k5XB9x9n8BIq+bzAsf9ry4mwrzfA3GjBGgcjLPAa6rDRR348brDbsgfTG1a1gqEe80 41u7gLDKTcKPQ/mk5vfzdExDrrhYwSjohYUEP1Sftx7DCAAODijS1Xzi6BFCfsIXDoY0 X40+K745f+cPBnfSJrAw8rt8Io8jiqZKwL04WsWt4OOt5P+SHwKQeIrYssB+dJ4nUK6A f5l/9Tx1wFxQCUtZyazObH5YuFNg1nWACRCkJtB8cSclqQtEsAnSAAWICJNyMau9o2D/ AhXd7klPNn6N8G8kjAWSUToXgpflZkX41dUXkKYG6HHIkpI5OFBKPyh703dHY5mU2d83 b1yw==
X-Gm-Message-State AODbwcAx8I3Jca4xz7JuCYKbo95x8XC1T6mod2pKx1I29qNr0c9VYBjN pHQSzrdOn+VzqqL08Mpk21k206x75g==
X-Received by 10.237.36.251 with SMTP id u56mr1149589qtc.154.1494518342019; Thu, 11 May 2017 08:59:02 -0700 (PDT)
MIME-Version 1.0
X-Google-Sender-Auth OJIZKuirOqoUiW7sKTeT5HqTIMk
Content-Type text/plain; charset="UTF-8"
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 43
Organization linux.* mail to news gateway
X-Original-Cc Arnd Bergmann <arnd@arndb.de>, Frank Rowand <frowand.list@gmail.com>, Marek Szyprowski <m.szyprowski@samsung.com>, "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
X-Original-Date Thu, 11 May 2017 17:59:01 +0200
X-Original-Message-ID <CAExDi1Q4xAxYWEtTA25FOoGB9Y3=pi4CxmuUpMiAe_+OVUErGg@mail.gmail.com>
X-Original-References <20170511122458.3862716-1-arnd@arndb.de> <20170511122458.3862716-2-arnd@arndb.de> <CAL_Jsq+MHx8Vgj9g4-p3Xs57LNpZB-20opbq2xk9jz-K-57iSw@mail.gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1639819

Show key headers only | View raw


On Thu, May 11, 2017 at 4:50 PM, Rob Herring <robh+dt@kernel.org> wrote:
> On Thu, May 11, 2017 at 7:24 AM, Arnd Bergmann <arnd@arndb.de> wrote:
>> It's the pointer that is supposed to be const, not the return
>> type of the function.
>>
>> drivers/of/of_reserved_mem.c: In function '__reserved_mem_init_node':
>> drivers/of/of_reserved_mem.c:200:7: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers]
>>    int const (*initfn)(struct reserved_mem *rmem) = i->data;
>>
>> Fixes: 17a70355ea57 ("of: fix sparse warnings in fdt, irq, reserved mem, and resolver code")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>>  drivers/of/of_reserved_mem.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
>> index 4dec07ea510f..3f03ec004829 100644
>> --- a/drivers/of/of_reserved_mem.c
>> +++ b/drivers/of/of_reserved_mem.c
>> @@ -197,7 +197,7 @@ static int __init __reserved_mem_init_node(struct reserved_mem *rmem)
>>         const struct of_device_id *i;
>>
>>         for (i = __reservedmem_of_table; i < &__rmem_of_table_sentinel; i++) {
>> -               int const (*initfn)(struct reserved_mem *rmem) = i->data;
>> +               int (* const initfn)(struct reserved_mem *rmem) = i->data;
>
> Why did you move the const here? That doesn't seem to help with sparse.

The original sparse warning was:
    ../drivers/of/of_reserved_mem.c:200:50: warning: incorrect type in
initializer (different modifiers)
    ../drivers/of/of_reserved_mem.c:200:50:    expected int (
*[usertype] initfn )( ... )
    ../drivers/of/of_reserved_mem.c:200:50:    got void const *const data
right?
And we're talking about a function (pointer) type.
Functions return a rvalue thus qualifiers are irrelevant for them,
so having 'int const (*initfn)(...)' instead of 'int (*initfn)()' should
solve nothing.

Same for the others patch in this series.

-- Luc Van Oostenryck

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH 2/2] of: reserved_mem: fix 'const' annotation Arnd Bergmann <arnd@arndb.de> - 2017-05-11 14:30 +0200
  Re: [PATCH 2/2] of: reserved_mem: fix 'const' annotation Rob Herring <robh+dt@kernel.org> - 2017-05-11 17:00 +0200
    Re: [PATCH 2/2] of: reserved_mem: fix 'const' annotation Arnd Bergmann <arnd@arndb.de> - 2017-05-11 17:10 +0200
    Re: [PATCH 2/2] of: reserved_mem: fix 'const' annotation Luc Van Oostenryck <luc.vanoostenryck@gmail.com> - 2017-05-11 18:00 +0200

csiph-web