forked from Minki/linux
net: ipa: only set endpoint netdev pointer when in use
In ipa_modem_start(), we set endpoint netdev pointers before the network device is registered. If registration fails, we don't undo those assignments. Instead, wait to assign the netdev pointer until after registration succeeds. Set these endpoint netdev pointers to NULL in ipa_modem_stop() before unregistering the network device. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
49e76a4189
commit
57f63faf05
@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
/* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
|
||||
* Copyright (C) 2018-2020 Linaro Ltd.
|
||||
* Copyright (C) 2018-2021 Linaro Ltd.
|
||||
*/
|
||||
|
||||
#include <linux/errno.h>
|
||||
@ -213,18 +213,18 @@ int ipa_modem_start(struct ipa *ipa)
|
||||
goto out_set_state;
|
||||
}
|
||||
|
||||
ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]->netdev = netdev;
|
||||
ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]->netdev = netdev;
|
||||
|
||||
SET_NETDEV_DEV(netdev, &ipa->pdev->dev);
|
||||
priv = netdev_priv(netdev);
|
||||
priv->ipa = ipa;
|
||||
|
||||
ret = register_netdev(netdev);
|
||||
if (ret)
|
||||
free_netdev(netdev);
|
||||
else
|
||||
if (!ret) {
|
||||
ipa->modem_netdev = netdev;
|
||||
ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]->netdev = netdev;
|
||||
ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]->netdev = netdev;
|
||||
} else {
|
||||
free_netdev(netdev);
|
||||
}
|
||||
|
||||
out_set_state:
|
||||
if (ret)
|
||||
@ -263,6 +263,8 @@ int ipa_modem_stop(struct ipa *ipa)
|
||||
if (ret)
|
||||
goto out_set_state;
|
||||
|
||||
ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]->netdev = NULL;
|
||||
ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]->netdev = NULL;
|
||||
ipa->modem_netdev = NULL;
|
||||
unregister_netdev(netdev);
|
||||
free_netdev(netdev);
|
||||
|
Loading…
Reference in New Issue
Block a user