Commit 077e770f authored by Alex Elder's avatar Alex Elder Committed by Jakub Kicinski

net: ipa: ipa_stop() does not return an error

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: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 57f63faf
...@@ -240,7 +240,6 @@ int ipa_modem_stop(struct ipa *ipa) ...@@ -240,7 +240,6 @@ int ipa_modem_stop(struct ipa *ipa)
{ {
struct net_device *netdev = ipa->modem_netdev; struct net_device *netdev = ipa->modem_netdev;
enum ipa_modem_state state; enum ipa_modem_state state;
int ret;
/* Only attempt to stop the modem if it's running */ /* Only attempt to stop the modem if it's running */
state = atomic_cmpxchg(&ipa->modem_state, IPA_MODEM_STATE_RUNNING, state = atomic_cmpxchg(&ipa->modem_state, IPA_MODEM_STATE_RUNNING,
...@@ -257,29 +256,20 @@ int ipa_modem_stop(struct ipa *ipa) ...@@ -257,29 +256,20 @@ int ipa_modem_stop(struct ipa *ipa)
/* Prevent the modem from triggering a call to ipa_setup() */ /* Prevent the modem from triggering a call to ipa_setup() */
ipa_smp2p_disable(ipa); ipa_smp2p_disable(ipa);
/* Stop the queue and disable the endpoints if it's open */
if (netdev) { if (netdev) {
/* Stop the queue and disable the endpoints if it's open */ (void)ipa_stop(netdev);
ret = ipa_stop(netdev);
if (ret)
goto out_set_state;
ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]->netdev = NULL; ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]->netdev = NULL;
ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]->netdev = NULL; ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]->netdev = NULL;
ipa->modem_netdev = NULL; ipa->modem_netdev = NULL;
unregister_netdev(netdev); unregister_netdev(netdev);
free_netdev(netdev); free_netdev(netdev);
} else {
ret = 0;
} }
out_set_state: atomic_set(&ipa->modem_state, IPA_MODEM_STATE_STOPPED);
if (ret)
atomic_set(&ipa->modem_state, IPA_MODEM_STATE_RUNNING);
else
atomic_set(&ipa->modem_state, IPA_MODEM_STATE_STOPPED);
smp_mb__after_atomic(); smp_mb__after_atomic();
return ret; return 0;
} }
/* Treat a "clean" modem stop the same as a crash */ /* Treat a "clean" modem stop the same as a crash */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment