linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Eduardo Valentin <edubezval@gmail.com>
Cc: Zhang Rui <rui.zhang@intel.com>,
	Kevin Wangtao <kevin.wangtao@linaro.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Linux PM list <linux-pm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: thermal/drivers/hisi: Remove bogus const from function return type
Date: Tue, 2 Jan 2018 08:36:31 +0100	[thread overview]
Message-ID: <CAMuHMdU-_Obwo8t=2oE3CfEmZ0nks03HNssS53cKVfbLCi2sdA@mail.gmail.com> (raw)
In-Reply-To: <20180101182123.GA3753@localhost.localdomain>

Hi Eduardo,

On Mon, Jan 1, 2018 at 7:21 PM, Eduardo Valentin <edubezval@gmail.com> wrote:
> On Sun, Nov 19, 2017 at 12:04:27PM +0100, Geert Uytterhoeven wrote:
>> With gcc-4.1.2:
>>
>>     drivers/thermal/hisi_thermal.c: In function ‘hisi_thermal_probe’:
>>     drivers/thermal/hisi_thermal.c:530: warning: type qualifiers ignored on function return type
>>
>> Remove the "const" keyword to fix this.
>
> Interesting.
>
> I intentionally asked Daniel to include the modifier because sparse
> pointed this to me:
>
> This patch adds this issue to hisi driver (sparse)
>
> drivers/thermal/hisi_thermal.c:398:24: warning: incorrect type in assignment (different modifiers)
> drivers/thermal/hisi_thermal.c:398:24:    expected int ( *platform_probe )( ... )
> drivers/thermal/hisi_thermal.c:398:24:    got void const *

Sparse doesn't like assigning void pointers to function pointers without a cast.

> which makes sense to me to be const, given that it is receiving the return
> of a function which returns a const void *.
> nclude/linux/of_device.h:extern const void *of_device_get_match_data(const struct device *dev);

That const applies to what is returned by of_device_get_match_data() (a const
void *), not to what is returned by the returned function (an int).

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2018-01-02  7:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-19 11:04 [PATCH] thermal/drivers/hisi: Remove bogus const from function return type Geert Uytterhoeven
2018-01-01 18:21 ` Eduardo Valentin
2018-01-02  7:36   ` Geert Uytterhoeven [this message]
2018-01-02 11:44 ` [PATCH] " Arnd Bergmann
2018-01-02 17:50   ` Eduardo Valentin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMuHMdU-_Obwo8t=2oE3CfEmZ0nks03HNssS53cKVfbLCi2sdA@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=arnd@arndb.de \
    --cc=edubezval@gmail.com \
    --cc=kevin.wangtao@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).