Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751664AbeABHge (ORCPT + 1 other); Tue, 2 Jan 2018 02:36:34 -0500 Received: from mail-qk0-f179.google.com ([209.85.220.179]:33741 "EHLO mail-qk0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751109AbeABHgd (ORCPT ); Tue, 2 Jan 2018 02:36:33 -0500 X-Google-Smtp-Source: ACJfBosufxoaYMZ6LTm93MSfmSL13gHNL1JqgY90wgFZydttxWgT0o0Dns8IlfZVlR4iWHXJz1rKO705JTZb8FTcI1E= MIME-Version: 1.0 In-Reply-To: <20180101182123.GA3753@localhost.localdomain> References: <1511089467-20525-1-git-send-email-geert@linux-m68k.org> <20180101182123.GA3753@localhost.localdomain> From: Geert Uytterhoeven Date: Tue, 2 Jan 2018 08:36:31 +0100 X-Google-Sender-Auth: rL0aOjKXz-mtoJnk8orRdexaNQY Message-ID: Subject: Re: thermal/drivers/hisi: Remove bogus const from function return type To: Eduardo Valentin Cc: Zhang Rui , Kevin Wangtao , Arnd Bergmann , Linux PM list , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Hi Eduardo, On Mon, Jan 1, 2018 at 7:21 PM, Eduardo Valentin 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