public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: "Scott J. Crouch" <scottjcrouch@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	Broadcom internal kernel review list
	<bcm-kernel-feedback-list@broadcom.com>,
	kernel-janitors@vger.kernel.org,
	linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: vchiq: add 'static' to function definition
Date: Sun, 30 Oct 2022 13:43:46 +1100	[thread overview]
Message-ID: <b874e6ff-6a19-410f-1fe8-2334a58f503a@gmail.com> (raw)
In-Reply-To: <52599d6e-dc16-4186-9fb9-d17ce428fe9c@app.fastmail.com>

On 28/10/22 01:08, Arnd Bergmann wrote:
> On Sat, Oct 22, 2022, at 10:07, Greg Kroah-Hartman wrote:
>> On Sat, Oct 22, 2022 at 03:35:48PM +1100, Scott J. Crouch wrote:
> 
>> Nice try, but this breaks the build in a very horrible and strange way
>> that no one has been able to figure out yet:
> 
> I got curious and figured out what happens:
> 
> Without CONFIG_OF, of_match_node() always returns NULL, so
> vchiq_probe() returns -EINVAL unconditionally before calling
> vchiq_platform_init(). 
> 
> If vchiq_platform_init() is marked 'static', gcc's dead code
> elimination then eliminates it, which in turn means that
> 'g_fragments_base' is never initialized and gets replaced
> with a NULL pointer.

Good spotting.  Actually, I was clumsily learning how to run sparse on the
staging directory and wasn't sure what config to use that didn't involve
enabling everything manually.  But from what I can tell, it's OF_OVERLAY (or
something downstream of that) that gets rid of the warning.  BCM2835_VCHIQ
requires BCM_VIDEOCORE which already depends on OF.  I'm confused because I
don't actually know how to reproduce the gcc warning without manually enabling
the module such that OF is enabled but OF_OVERLAY isn't, since allmodconfig
enables both -- maybe there's a way to do that.

I'm also confused why devm_rpi_firmware_get() doesn't have the same problem as
of_match_node() just above it -- it returns NULL when RASPBERRYPI_FIRMWARE is
unset, but gcc still builds without the warning.

Scott.

  reply	other threads:[~2022-10-30  2:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-22  4:35 [PATCH] staging: vchiq: add 'static' to function definition Scott J. Crouch
2022-10-22  8:07 ` Greg Kroah-Hartman
2022-10-27 14:08   ` Arnd Bergmann
2022-10-30  2:43     ` Scott J. Crouch [this message]
2022-10-30 10:46       ` Arnd Bergmann
2022-10-31  3:54         ` Scott J. Crouch
2022-10-22 18:04 ` kernel test robot

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=b874e6ff-6a19-410f-1fe8-2334a58f503a@gmail.com \
    --to=scottjcrouch@gmail.com \
    --cc=arnd@arndb.de \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=f.fainelli@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux-staging@lists.linux.dev \
    /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