Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Cc: "Nuno Sá" <nuno.sa@analog.com>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Antoniu Miclaus" <antoniu.miclaus@analog.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux@analog.com, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] iio: adc: ti-ads131m02: Drop redundant NULL check on devm_clk_get_enabled()
Date: Mon, 6 Jul 2026 00:37:12 +0100	[thread overview]
Message-ID: <20260706003712.753a5870@jic23-huawei> (raw)
In-Reply-To: <20260705172438.119204-3-krzysztof.kozlowski@oss.qualcomm.com>

On Sun,  5 Jul 2026 19:24:39 +0200
Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> wrote:

> devm_clk_get_enabled() does not return NULL (only valid clock or ERR
> pointer), so simplify the code to drop redundant IS_ERR_OR_NULL().
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
See the stub.

static inline struct clk *devm_clk_get_enabled(struct device *dev,
					       const char *id)
{
	return NULL;
}
Not sure what the reasoning behind that is.  Maybe that
clock could be already on?

We could I guess make this driver depend on one of the clk
related configs, but today it doesn't. So to me this NULL check smells
of protection we don't need so I think the change is fine, but the
patch description should reflect that stub and it being considered
reasonable to plough on regardless.

Jonathan


> ---
>  drivers/iio/adc/ti-ads131m02.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/iio/adc/ti-ads131m02.c b/drivers/iio/adc/ti-ads131m02.c
> index 2f8f75c8216b..27c8abff216b 100644
> --- a/drivers/iio/adc/ti-ads131m02.c
> +++ b/drivers/iio/adc/ti-ads131m02.c
> @@ -848,14 +848,8 @@ static int ads131m_parse_clock(struct ads131m_priv *priv, bool *is_xtal)
>  	int ret;
>  
>  	clk = devm_clk_get_enabled(dev, NULL);
> -	if (IS_ERR_OR_NULL(clk)) {
> -		if (IS_ERR(clk))
> -			ret = PTR_ERR(clk);
> -		else
> -			ret = -ENODEV;
> -
> -		return dev_err_probe(dev, ret, "clk get enabled failed\n");
> -	}
> +	if (IS_ERR(clk))
> +		return dev_err_probe(dev, PTR_ERR(clk), "clk get enabled failed\n");
>  
>  	ret = device_property_match_string(dev, "clock-names", "xtal");
>  	if (ret > 0)


  parent reply	other threads:[~2026-07-05 23:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-05 17:24 [PATCH 1/2] iio: adc: ti-ads131m02: Drop redundant NULL check on devm_clk_get_enabled() Krzysztof Kozlowski
2026-07-05 17:24 ` [PATCH 2/2] iio: adc: ade9000: Drop incorrect kerneldoc marker Krzysztof Kozlowski
2026-07-05 17:37   ` Joshua Crofts
2026-07-05 17:50   ` Maxwell Doose
2026-07-05 23:37     ` Jonathan Cameron
2026-07-05 17:34 ` [PATCH 1/2] iio: adc: ti-ads131m02: Drop redundant NULL check on devm_clk_get_enabled() Joshua Crofts
2026-07-05 23:37 ` Jonathan Cameron [this message]
2026-07-06  6:01   ` Krzysztof Kozlowski
2026-07-06  6:04   ` Andy Shevchenko
2026-07-06  6:55     ` Krzysztof Kozlowski
2026-07-06  7:03       ` Andy Shevchenko
2026-07-06  6:01 ` Andy Shevchenko

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=20260706003712.753a5870@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=antoniu.miclaus@analog.com \
    --cc=dlechner@baylibre.com \
    --cc=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@analog.com \
    --cc=nuno.sa@analog.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