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

From: Jonathan Cameron

Date: Sun Jul 05 2026 - 18:29:20 EST


On Sun, 5 Jul 2026 21:31:54 +0200
Joshua Crofts <joshua.crofts1@xxxxxxxxx> wrote:

> On Sun, 5 Jul 2026 at 20:17, Sanjay Chitroda <sanjayembeddedse@xxxxxxxxx> wrote:
> >
> >
> >
> > On 2 July 2026 10:52:05 pm IST, Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
> > >On Thu, 02 Jul 2026 21:48:00 +0530
> > >Sanjay Chitroda via B4 Relay <devnull+sanjayembeddedse.gmail.com@xxxxxxxxxx> wrote:
> > >
> > >> From: Sanjay Chitroda <sanjayembeddedse@xxxxxxxxx>
> > >>
> > >> 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