Thread (22 messages) 22 messages, 6 authors, 20d ago

Re: [PATCH v2 3/6] iio: hid-sensors: Use implicit NULL pointer checks

From: Jonathan Cameron <jic23@kernel.org>
Date: 2026-07-05 22:29:08
Also in: linux-iio, lkml

On Sun, 5 Jul 2026 21:31:54 +0200
Joshua Crofts [off-list ref] wrote:
On Sun, 5 Jul 2026 at 20:17, Sanjay Chitroda [off-list ref] wrote:
quoted


On 2 July 2026 10:52:05 pm IST, Jonathan Cameron [off-list ref] wrote:  
quoted
On Thu, 02 Jul 2026 21:48:00 +0530
Sanjay Chitroda via B4 Relay [off-list ref] wrote:
 
quoted
From: Sanjay Chitroda <redacted>

Replace explicit NULL pointer comparisons with implicit checks across
HID sensor IIO drivers to follow the preferred kernel coding style.  
Is there anything in the kernel wide style guides about this?

I do prefer this style in IIO but perhaps we should document it
as local IIO style rather than implying general guidance (unless
there is some!)
 
Hi Jonathan,

I took reference of existing IIO commit message and followed the same.

There is no kernel coding guideline for NULL pointer. If you think it would be useful, I would be happy to work on documenting the preferred conventions under "Documentation/driver-api/iio/", for example as a new "coding-style.rst" or similar document.  
Probably would go in a subsystem maintainer profile.
https://docs.kernel.org/maintainer/maintainer-entry-profile.html

If you want to take a stab at just a bit on local style preferences
that would be great.  I can probably find time to throw something
together for other standard sections like timelines.

Not sure whether any coding style kerneldoc mentions this style,
nevertheless checkpatch prefers (!foo) over (foo == NULL),  see the
COMPARISON_TO_NULL section in the checkpatch kerneldoc.
Thanks for digging into this.  If it got into checkpatch it was
reviewed and is generally accepted, whether or not anyone updated
the descriptive stuff on kernel style.  Perhaps just refer to that
in the commit message to avoid confusion.

Thanks,

Jonathan

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help