Linux Input/HID development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Sanjay Chitroda via B4 Relay
	<devnull+sanjayembeddedse.gmail.com@kernel.org>
Cc: sanjayembeddedse@gmail.com,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Jiri Kosina" <jikos@kernel.org>,
	"Srinivas Pandruvada" <srinivas.pandruvada@linux.intel.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-input@vger.kernel.org,
	"Maxwell Doose" <m32285159@gmail.com>
Subject: Re: [PATCH v2 3/6] iio: hid-sensors: Use implicit NULL pointer checks
Date: Thu, 2 Jul 2026 18:22:05 +0100	[thread overview]
Message-ID: <20260702182205.388efe24@jic23-huawei> (raw)
In-Reply-To: <20260702-15-jun-hid-iio-alignment-v2-3-b87f01f5efbc@gmail.com>

On Thu, 02 Jul 2026 21:48:00 +0530
Sanjay Chitroda via B4 Relay <devnull+sanjayembeddedse.gmail.com@kernel.org> wrote:

> From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
> 
> 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!)

> 
> Convert 'if (indio_dev == NULL)' -> 'if (!indio_dev)'.
> 
> No functional change.
> 
> Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
> Reviewed-by: Maxwell Doose <m32285159@gmail.com>
> ---
>  drivers/iio/accel/hid-sensor-accel-3d.c       | 2 +-
>  drivers/iio/magnetometer/hid-sensor-magn-3d.c | 2 +-
>  drivers/iio/orientation/hid-sensor-incl-3d.c  | 2 +-
>  drivers/iio/orientation/hid-sensor-rotation.c | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c
> index 9197f3424c0c..225f8dd65ab1 100644
> --- a/drivers/iio/accel/hid-sensor-accel-3d.c
> +++ b/drivers/iio/accel/hid-sensor-accel-3d.c
> @@ -325,7 +325,7 @@ static int hid_accel_3d_probe(struct platform_device *pdev)
>  
>  	indio_dev = devm_iio_device_alloc(&pdev->dev,
>  					  sizeof(struct accel_3d_state));
> -	if (indio_dev == NULL)
> +	if (!indio_dev)
>  		return -ENOMEM;
>  
>  	platform_set_drvdata(pdev, indio_dev);
> diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
> index ad10fa20fae0..738bad65d74d 100644
> --- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c
> +++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
> @@ -463,7 +463,7 @@ static int hid_magn_3d_probe(struct platform_device *pdev)
>  
>  	indio_dev = devm_iio_device_alloc(&pdev->dev,
>  					  sizeof(struct magn_3d_state));
> -	if (indio_dev == NULL)
> +	if (!indio_dev)
>  		return -ENOMEM;
>  
>  	platform_set_drvdata(pdev, indio_dev);
> diff --git a/drivers/iio/orientation/hid-sensor-incl-3d.c b/drivers/iio/orientation/hid-sensor-incl-3d.c
> index 870c8929491e..c8efb0dab8b6 100644
> --- a/drivers/iio/orientation/hid-sensor-incl-3d.c
> +++ b/drivers/iio/orientation/hid-sensor-incl-3d.c
> @@ -302,7 +302,7 @@ static int hid_incl_3d_probe(struct platform_device *pdev)
>  
>  	indio_dev = devm_iio_device_alloc(&pdev->dev,
>  					  sizeof(struct incl_3d_state));
> -	if (indio_dev == NULL)
> +	if (!indio_dev)
>  		return -ENOMEM;
>  
>  	platform_set_drvdata(pdev, indio_dev);
> diff --git a/drivers/iio/orientation/hid-sensor-rotation.c b/drivers/iio/orientation/hid-sensor-rotation.c
> index 2dad0453fc67..6db253c1635d 100644
> --- a/drivers/iio/orientation/hid-sensor-rotation.c
> +++ b/drivers/iio/orientation/hid-sensor-rotation.c
> @@ -274,7 +274,7 @@ static int hid_dev_rot_probe(struct platform_device *pdev)
>  
>  	indio_dev = devm_iio_device_alloc(&pdev->dev,
>  					  sizeof(struct dev_rot_state));
> -	if (indio_dev == NULL)
> +	if (!indio_dev)
>  		return -ENOMEM;
>  
>  	platform_set_drvdata(pdev, indio_dev);
> 


  reply	other threads:[~2026-07-02 17:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-02 16:17 [PATCH v2 0/6] HID: iio: warning clean up and prefer kernel coding style Sanjay Chitroda via B4 Relay
2026-07-02 16:17 ` [PATCH v2 1/6] iio: hid-sensors: add/remove blank line Sanjay Chitroda via B4 Relay
2026-07-02 17:30   ` Jonathan Cameron
2026-07-02 16:17 ` [PATCH v2 2/6] iio: hid-sensors: align function parenthesis for readability Sanjay Chitroda via B4 Relay
2026-07-02 17:20   ` Jonathan Cameron
2026-07-03 12:52     ` Andy Shevchenko
2026-07-04  1:09       ` srinivas pandruvada
2026-07-02 16:18 ` [PATCH v2 3/6] iio: hid-sensors: Use implicit NULL pointer checks Sanjay Chitroda via B4 Relay
2026-07-02 17:22   ` Jonathan Cameron [this message]
2026-07-02 16:18 ` [PATCH v2 4/6] iio: humidity: hid-sensor-humidity: use common device for devres Sanjay Chitroda via B4 Relay
2026-07-02 17:03   ` sashiko-bot
2026-07-02 17:26   ` Jonathan Cameron
2026-07-02 16:18 ` [PATCH v2 5/6] iio: position: hid-sensor-custom-intel-hinge: " Sanjay Chitroda via B4 Relay
2026-07-02 17:18   ` sashiko-bot
2026-07-02 17:26   ` Jonathan Cameron
2026-07-02 16:18 ` [PATCH v2 6/6] iio: temperature: hid-sensor-temperature: " Sanjay Chitroda via B4 Relay
2026-07-02 17:28   ` sashiko-bot
2026-07-02 17:29   ` Jonathan Cameron

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=20260702182205.388efe24@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=devnull+sanjayembeddedse.gmail.com@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jikos@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m32285159@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=sanjayembeddedse@gmail.com \
    --cc=srinivas.pandruvada@linux.intel.com \
    /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