mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Amir Atef via B4 Relay
	<devnull+amiratefabdallah1122.gmail.com@kernel.org>,
	amiratefabdallah1122@gmail.com,
	Lars-Peter Clausen <lars@metafoo.de>,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	David Lechner <dlechner@baylibre.com>,
	Nuno Sa <nuno.sa@analog.com>, Andy Shevchenko <andy@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-iio@vger.kernel.org, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] staging: iio: frequency: ad9834: use guard(mutex)
Date: Mon, 19 Oct 2026 10:43:01 +0300	[thread overview]
Message-ID: <atXKBfDxumHGUh8M@ashevche-desk.local> (raw)
In-Reply-To: <20261017205454.0dda6c10@jic23-hlaptop>

On Sat, Oct 17, 2026 at 08:54:54PM +0100, Jonathan Cameron wrote:
> On Sat, 17 Oct 2026 02:45:52 +0300
> Amir Atef via B4 Relay <devnull+amiratefabdallah1122.gmail.com@kernel.org> wrote:

...

> >  		ret = spi_sync(st->spi, &st->msg);
> 
> I'd rather see all error handled at point where they originate, rather
> than only some (with special case for the last call) so here and similar places, do 
> 		if (ret)
> 			return ret;
> 
> 		break;
> 
> Or you could even do a return len; here if you prefer.

I'm definitely against this. return len is a common non-error case, that's
better to be at one place.

> >  		break;
> >  	default:
> > -		ret = -ENODEV;
> > +		return -ENODEV;
> >  	}
> > -	mutex_unlock(&st->lock);
> >  
> >  	return ret ? ret : len;

So, if got the above way, use

	return len;

here at the end, and 'break;' statements in the respective cases.

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2026-10-19  7:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16 23:45 Amir Atef via B4 Relay
2026-10-17 19:54 ` Jonathan Cameron
2026-10-19  7:43   ` Andy Shevchenko [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=atXKBfDxumHGUh8M@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=amiratefabdallah1122@gmail.com \
    --cc=andy@kernel.org \
    --cc=devnull+amiratefabdallah1122.gmail.com@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --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

all inboxes | Powered by JetHome®