Re: [PATCH net-next 4/7] net: ipa: ipa_stop() does not return an error

From: Leon Romanovsky
Date: Sun Apr 11 2021 - 02:34:09 EST


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@xxxxxxxxxx>
> ---
> 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.

Thanks