Re: net: rnpgbe: Pass an expression directly in rnpgbe_rm_adapter()

From
Andrew Lunn <andrew@lunn.ch>
Date
2026-07-16 13:43:29
Also in
kernel-janitors, lkml
Reply to
Dan Carpenter, 2026-07-16
On Thu, Jul 16, 2026 at 04:34:05PM +0300, Dan Carpenter wrote:
On Thu, Jul 16, 2026 at 03:24:22PM +0200, Andrew Lunn wrote:
quoted
On Thu, Jul 16, 2026 at 11:48:43AM +0200, Markus Elfring wrote:
quoted
quoted
In C writing if (!p) and if (p == NULL) are always equivalent but weirdly
the NULL doesn't have to zero.  It's part of the C FAQ.
https://c-faq.com/null/machexamp.html It's just a bit of fun trivia that
doesn't really matter unless you have a time machine.  Even if you invented
a time machine, the code here would still be fine because we have a NULL
test before dereferencing the results of our pointer math.
Which expression evaluations would you interpret as pointer dereferences finally?
https://c-faq.com/sx1/
This is all interesting, but nobody has yet explain how this function
can be called such that we have a NULL pointer.
mucse cannot be NULL.

We call pci_set_drvdata() during probe() and it is still valid when
we call the remove() function.
Same as what i thought. So while this is an interesting discussion,
please could someone post the real fix, remove the NULL pointer check.

       Andrew
Thread (23 messages) 23 messages, 6 authors, last reply 2026-07-17
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help