[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <194b351c-bae-27a-1875-9ad3c47292e@linux-m68k.org>
Date: Tue, 27 Jul 2021 20:19:35 +1000 (AEST)
From: Finn Thain <fthain@...ux-m68k.org>
To: Geert Uytterhoeven <geert@...ux-m68k.org>
cc: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Sascha Hauer <kernel@...gutronix.de>,
linux-m68k <linux-m68k@...ts.linux-m68k.org>
Subject: Re: [PATCH 1/5] nubus: Simplify check in remove callback
On Tue, 27 Jul 2021, Geert Uytterhoeven wrote:
> On Tue, Jul 27, 2021 at 11:50 AM Finn Thain <fthain@...ux-m68k.org> wrote:
> > On Tue, 27 Jul 2021, Uwe Kleine-König wrote:
> > > Apart from that, the compiler might already assume dev->driver being
> > > non-NULL after to_nubus_driver(dev->driver) was called.
> >
> > I don't understand how a compiler can make that assumption. But then,
> > I don't know why compilers do a lot of the things they do...
>
> It is one of those recent optimizations people have been complaining
> about. Once you have dereferenced a pointer, compilers may remove all
> further NULL-checks, assuming they can't happen, as the code would have
> crashed anyway before due to the dereference.
But that's the point -- there is no dereference, just pointer arithmetic.
> Good luck running on bare metal with RAM at zero ;-)
Quite.
Powered by blists - more mailing lists