netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Alex Elder <elder@linaro.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: Sun, 11 Apr 2021 16:28:31 +0300	[thread overview]
Message-ID: <YHL5fwkYyHvQG2Z4@unreal> (raw)
In-Reply-To: <1f5c3d2c-f22a-ef5e-f282-fb2dec4479f3@linaro.org>

On Sun, Apr 11, 2021 at 08:09:55AM -0500, Alex Elder wrote:
> On 4/11/21 1:34 AM, Leon Romanovsky wrote:
> > On Fri, Apr 09, 2021 at 01:07:19PM -0500, Alex Elder wrote:
> >> In ipa_modem_stop(), if the modem netdev pointer is non-null we call
> >> ipa_stop().  We check for an error and if one is returned we handle
> >> it.  But ipa_stop() never returns an error, so this extra handling
> >> is unnecessary.  Simplify the code in ipa_modem_stop() based on the
> >> knowledge no error handling is needed at this spot.
> >>
> >> Signed-off-by: Alex Elder <elder@linaro.org>
> >> ---
> >>  drivers/net/ipa/ipa_modem.c | 18 ++++--------------
> >>  1 file changed, 4 insertions(+), 14 deletions(-)
> > 
> > <...>
> > 
> >> +	/* Stop the queue and disable the endpoints if it's open */
> >>  	if (netdev) {
> >> -		/* Stop the queue and disable the endpoints if it's open */
> >> -		ret = ipa_stop(netdev);
> >> -		if (ret)
> >> -			goto out_set_state;
> >> -
> >> +		(void)ipa_stop(netdev);
> > 
> > This void casting is not needed here and in more general case sometimes
> > even be seen as a mistake, for example if the returned attribute declared
> > as __must_check.
> 
> I accept your point but I feel like it's sort of a 50/50 thing.
> 
> 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 ???

> 
> The void cast here says "I know this returns a result, but I am
> intentionally not checking it."  If it had been __must_check I
> would certainly have checked it.  
> 
> That being said, I don't really care that much, so I'll plan
> to post version 2, which will drop this cast (I'll probably
> add a comment though).

Thanks

> 
> Thanks.
> 
> 					-Alex
> 
> > 
> > Thanks
> > 
> 

  reply	other threads:[~2021-04-11 13:30 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 [this message]
2021-04-11 13:42         ` Alex Elder
2021-04-12  7:26           ` Leon Romanovsky
2021-04-12  7:45             ` Alex Elder
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=YHL5fwkYyHvQG2Z4@unreal \
    --to=leon@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=cpratapa@codeaurora.org \
    --cc=davem@davemloft.net \
    --cc=elder@kernel.org \
    --cc=elder@linaro.org \
    --cc=evgreen@chromium.org \
    --cc=kuba@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;
as well as URLs for NNTP newsgroup(s).