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 <el...@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. 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. -Alex > > Thanks >