Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Alex Elder <elder@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Alex Elder and committed by
Jakub Kicinski
077e770f 57f63faf

+4 -14
+4 -14
drivers/net/ipa/ipa_modem.c
··· 240 240 { 241 241 struct net_device *netdev = ipa->modem_netdev; 242 242 enum ipa_modem_state state; 243 - int ret; 244 243 245 244 /* Only attempt to stop the modem if it's running */ 246 245 state = atomic_cmpxchg(&ipa->modem_state, IPA_MODEM_STATE_RUNNING, ··· 256 257 /* Prevent the modem from triggering a call to ipa_setup() */ 257 258 ipa_smp2p_disable(ipa); 258 259 260 + /* Stop the queue and disable the endpoints if it's open */ 259 261 if (netdev) { 260 - /* Stop the queue and disable the endpoints if it's open */ 261 - ret = ipa_stop(netdev); 262 - if (ret) 263 - goto out_set_state; 264 - 262 + (void)ipa_stop(netdev); 265 263 ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]->netdev = NULL; 266 264 ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]->netdev = NULL; 267 265 ipa->modem_netdev = NULL; 268 266 unregister_netdev(netdev); 269 267 free_netdev(netdev); 270 - } else { 271 - ret = 0; 272 268 } 273 269 274 - out_set_state: 275 - if (ret) 276 - atomic_set(&ipa->modem_state, IPA_MODEM_STATE_RUNNING); 277 - else 278 - atomic_set(&ipa->modem_state, IPA_MODEM_STATE_STOPPED); 270 + atomic_set(&ipa->modem_state, IPA_MODEM_STATE_STOPPED); 279 271 smp_mb__after_atomic(); 280 272 281 - return ret; 273 + return 0; 282 274 } 283 275 284 276 /* Treat a "clean" modem stop the same as a crash */