mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alex Elder <elder@linaro.org>
To: Leon Romanovsky <leon@kernel.org>
Cc: davem@davemloft.net, kuba@kernel.org, bjorn.andersson@linaro.org,
	evgreen@chromium.org, cpratapa@codeaurora.org,
	subashab@codeaurora.org, elder@kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 4/7] net: ipa: ipa_stop() does not return an error
Date: Mon, 12 Apr 2021 02:45:38 -0500	[thread overview]
Message-ID: <dcfa0fae-1321-1583-cb46-1665e1a4ea93@linaro.org> (raw)
In-Reply-To: <YHP2IKZ7pB+l4a6O@unreal>

On 4/12/21 2:26 AM, Leon Romanovsky wrote:
> On Sun, Apr 11, 2021 at 08:42:15AM -0500, Alex Elder wrote:
>> On 4/11/21 8:28 AM, Leon Romanovsky wrote:
>>>> I think *not* checking an available return value is questionable
>>>> practice.  I'd really rather have a build option for a
>>>> "__need_not_check" tag and have "must_check" be the default.
>>> __need_not_check == void ???
>>
>> I'm not sure I understand your statement here, but...
> 
> We are talking about the same thing. My point was that __need_not_check
> is actually void. The API author was supposed to declare that by
> declaring that function doesn't return anything.

No, we are not.

Functions like strcpy() return a value, but that value is almost
never checked.  The returned value isn't an error, so there is
no real need to check that return value.  This is the kind of
thing I'm talking about that might be tagged __need_not_check.

A function that returns a value for no reason should be void,
I agree with that.

In the ipa_stop() case, the value *must* be returned because
it serves as an ->ndo_stop() function and has to adhere to
that function prototype.  The point of the current patch
was to simplify the code (defined privately in the current
source file), given knowledge that it never returns an error.

The compiler could ensure all calls to functions that return
a value actually check the return value.  And because I think
that's the best practice, I'd like to be able to run such a
check in my code.  But there are always exceptions, and that
would be the purpose of a __need_not_check tag.

I don't think this is worthy of any more discussion.

					-Alex

  reply	other threads:[~2021-04-12  7:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-09 18:07 [PATCH net-next 0/7] net: ipa: a few small fixes Alex Elder
2021-04-09 18:07 ` [PATCH net-next 1/7] net: ipa: relax pool entry size requirement Alex Elder
2021-04-09 18:07 ` [PATCH net-next 2/7] net: ipa: update sequence type for modem TX endpoint Alex Elder
2021-04-09 18:07 ` [PATCH net-next 3/7] net: ipa: only set endpoint netdev pointer when in use Alex Elder
2021-04-09 18:07 ` [PATCH net-next 4/7] net: ipa: ipa_stop() does not return an error Alex Elder
2021-04-11  6:34   ` Leon Romanovsky
2021-04-11 13:09     ` Alex Elder
2021-04-11 13:28       ` Leon Romanovsky
2021-04-11 13:42         ` Alex Elder
2021-04-12  7:26           ` Leon Romanovsky
2021-04-12  7:45             ` Alex Elder [this message]
2021-04-09 18:07 ` [PATCH net-next 5/7] net: ipa: get rid of empty IPA functions Alex Elder
2021-04-09 18:07 ` [PATCH net-next 6/7] net: ipa: get rid of empty GSI functions Alex Elder
2021-04-09 18:07 ` [PATCH net-next 7/7] net: ipa: three small fixes Alex Elder
2021-04-10  4:11 ` [PATCH net-next 0/7] net: ipa: a few " 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=dcfa0fae-1321-1583-cb46-1665e1a4ea93@linaro.org \
    --to=elder@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=cpratapa@codeaurora.org \
    --cc=davem@davemloft.net \
    --cc=elder@kernel.org \
    --cc=evgreen@chromium.org \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=subashab@codeaurora.org \
    /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®