public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Colin King (gmail)" <colin.i.king@gmail.com>
To: Dan Carpenter <dan.carpenter@linaro.org>,
	Tung Quang Nguyen <tung.q.nguyen@dektech.com.au>
Cc: Jon Maloy <jmaloy@redhat.com>, Ying Xue <ying.xue@windriver.com>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"tipc-discussion@lists.sourceforge.net"
	<tipc-discussion@lists.sourceforge.net>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH][next] tipc: remove redundant assignment to ret, simplify code
Date: Thu, 11 Apr 2024 11:43:47 +0100	[thread overview]
Message-ID: <3011ca26-08d4-4b4e-847e-d68c0751f98d@gmail.com> (raw)
In-Reply-To: <ce0a63fc-1985-4e25-a08b-c0045ae095f4@moroto.mountain>

On 11/04/2024 11:31, Dan Carpenter wrote:
> On Thu, Apr 11, 2024 at 10:04:10AM +0000, Tung Quang Nguyen wrote:
>>>
>> I suggest that err variable should be completely removed. Could you
>> please also do the same thing for this code ?
>> "
>> ...
>> err = skb_handler(skb, cb, tsk);
>> if (err) {
> 
> If we write the code as:
> 
> 	if (some_function(parameters)) {
> 
> then at first that looks like a boolean.  People probably think the
> function returns true/false.  But if we leave it as-is:
> 
> 	err = some_function(parameters);
> 	if (err) {
> 
> Then that looks like error handling.
> 
> So it's better and more readable to leave it as-is.
> 
> regards,
> dan carpenter

I concur with Dan's comments.

Colin

  reply	other threads:[~2024-04-11 10:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-11  9:17 [PATCH][next] tipc: remove redundant assignment to ret, simplify code Colin Ian King
2024-04-11 10:04 ` Tung Quang Nguyen
2024-04-11 10:31   ` Dan Carpenter
2024-04-11 10:43     ` Colin King (gmail) [this message]
2024-04-11 11:04       ` Tung Quang Nguyen
2024-04-11 11:27         ` Dan Carpenter
2024-04-11 11:42           ` Tung Quang Nguyen
2024-04-13  2:10 ` patchwork-bot+netdevbpf

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=3011ca26-08d4-4b4e-847e-d68c0751f98d@gmail.com \
    --to=colin.i.king@gmail.com \
    --cc=dan.carpenter@linaro.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jmaloy@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=tipc-discussion@lists.sourceforge.net \
    --cc=tung.q.nguyen@dektech.com.au \
    --cc=ying.xue@windriver.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