Path: csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod From: Luc Van Oostenryck 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: References: X-Original-To: Rob Herring 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: 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 , Frank Rowand , Marek Szyprowski , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" X-Original-Date: Thu, 11 May 2017 17:59:01 +0200 X-Original-Message-ID: X-Original-References: <20170511122458.3862716-1-arnd@arndb.de> <20170511122458.3862716-2-arnd@arndb.de> X-Original-Sender: linux-kernel-owner@vger.kernel.org Xref: csiph.com linux.kernel:1639819 On Thu, May 11, 2017 at 4:50 PM, Rob Herring wrote: > On Thu, May 11, 2017 at 7:24 AM, Arnd Bergmann 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 >> --- >> 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