linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Thorsten Blum <thorsten.blum@linux.dev>
Cc: Alex Elder <elder@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	greybus-dev@lists.linaro.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: greybus: Reformat code in gb_operation_sync_timeout()
Date: Mon, 14 Apr 2025 09:05:24 +0200	[thread overview]
Message-ID: <Z_yztGweLAfJgwXh@hovoldconsulting.com> (raw)
In-Reply-To: <20250413104802.49360-2-thorsten.blum@linux.dev>

On Sun, Apr 13, 2025 at 12:48:03PM +0200, Thorsten Blum wrote:
> Remove any unnecessary curly braces and combine 'else' and 'if' to an
> 'else if' to improve the code's readability and reduce indentation.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>  drivers/greybus/operation.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/greybus/operation.c b/drivers/greybus/operation.c
> index 8459e9bc0749..ba26504ccac3 100644
> --- a/drivers/greybus/operation.c
> +++ b/drivers/greybus/operation.c
> @@ -1157,16 +1157,12 @@ int gb_operation_sync_timeout(struct gb_connection *connection, int type,
>  		memcpy(operation->request->payload, request, request_size);
>  
>  	ret = gb_operation_request_send_sync_timeout(operation, timeout);
> -	if (ret) {
> +	if (ret)
>  		dev_err(&connection->hd->dev,
>  			"%s: synchronous operation id 0x%04x of type 0x%02x failed: %d\n",
>  			connection->name, operation->id, type, ret);
> -	} else {
> -		if (response_size) {
> -			memcpy(response, operation->response->payload,
> -			       response_size);
> -		}
> -	}
> +	else if (response_size)
> +		memcpy(response, operation->response->payload, response_size);

NAK

This just makes the code *less* readable.

Johan

  reply	other threads:[~2025-04-14  7:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-13 10:48 [PATCH] staging: greybus: Reformat code in gb_operation_sync_timeout() Thorsten Blum
2025-04-14  7:05 ` Johan Hovold [this message]
2025-04-14 15:00   ` Thorsten Blum
2025-04-15  6:36     ` Johan Hovold

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=Z_yztGweLAfJgwXh@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=elder@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=greybus-dev@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thorsten.blum@linux.dev \
    /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;
as well as URLs for NNTP newsgroup(s).