Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Chen Ni <nichen@iscas.ac.cn>
Cc: lars@metafoo.de, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: dac: ti-dac7311: Add check for spi_setup
Date: Sun, 7 Jul 2024 15:15:01 +0100	[thread overview]
Message-ID: <20240707151450.595fe29a@jic23-huawei> (raw)
In-Reply-To: <20240705084250.3006527-1-nichen@iscas.ac.cn>

On Fri,  5 Jul 2024 16:42:50 +0800
Chen Ni <nichen@iscas.ac.cn> wrote:

> Add check for the return value of spi_setup() and return the error
> if it fails in order to catch the error.
> 
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>

Hi Chen,

This driver is using dev_err_probe() in some error returns from
the probe function and not in others. It would be good to change them
all to dev_err_probe() as it's both shorter and brings other advantages
in some paths.   In meantime let's not introduce another one to convert!

I'll make the change and apply this.

Applied to the testing branch of iio.git. I'll rebase that on 6.11-rc1 once
that is available in a couple of weeks time. At that point it'll become
the iio.git togreg branch and be picked up by linux next etc


> ---
>  drivers/iio/dac/ti-dac7311.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/dac/ti-dac7311.c b/drivers/iio/dac/ti-dac7311.c
> index 7f89d2a52f49..8e8a8ab0ebf6 100644
> --- a/drivers/iio/dac/ti-dac7311.c
> +++ b/drivers/iio/dac/ti-dac7311.c
> @@ -249,7 +249,11 @@ static int ti_dac_probe(struct spi_device *spi)
>  
>  	spi->mode = SPI_MODE_1;
>  	spi->bits_per_word = 16;
> -	spi_setup(spi);
> +	ret = spi_setup(spi);
> +	if (ret < 0) {
> +		dev_err(dev, "spi_setup failed\n");
> +		return ret;
		return dev_err_probe(dev, ret, "spi_setup failed\n");
and drop the now unneeded brackets.
> +	}
>  
>  	indio_dev->info = &ti_dac_info;
>  	indio_dev->name = spi_get_device_id(spi)->name;


      reply	other threads:[~2024-07-07 14:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-05  8:42 [PATCH] iio: dac: ti-dac7311: Add check for spi_setup Chen Ni
2024-07-07 14:15 ` Jonathan Cameron [this message]

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=20240707151450.595fe29a@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nichen@iscas.ac.cn \
    /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