Skip to content

Careful cleanup in spi_exit #180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion esp_hosted_fg/host/linux/host_driver/esp32/esp_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static struct esp_serial_devs {
esp_rb_t rb;
void *priv;
struct mutex lock;
} devs[ESP_SERIAL_MINOR_MAX];
} devs[ESP_SERIAL_MINOR_MAX] = {{ 0 }};

static uint8_t serial_init_done;

Expand Down Expand Up @@ -260,6 +260,10 @@ void esp_serial_cleanup(void)
int i = 0;

for (i = 0; i < ESP_SERIAL_MINOR_MAX; i++) {
if (!devs[i].cdev.ops) {
printk(KERN_INFO "%s: cdev[%d] is not initialized\n", __func__, i);
continue;
}
cdev_del(&devs[i].cdev);
esp_rb_cleanup(&devs[i].rb);
mutex_destroy(&devs[i].lock);
Expand Down
4 changes: 2 additions & 2 deletions esp_hosted_fg/host/linux/host_driver/esp32/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,13 +671,13 @@ static int esp_add_interface(struct esp_adapter *adapter, u8 if_type, u8 if_num,

static void esp_remove_network_interfaces(struct esp_adapter *adapter)
{
if (adapter->priv[0]->ndev) {
if (adapter->priv[0] && adapter->priv[0]->ndev) {
netif_stop_queue(adapter->priv[0]->ndev);
unregister_netdev(adapter->priv[0]->ndev);
free_netdev(adapter->priv[0]->ndev);
}

if (adapter->priv[1]->ndev) {
if (adapter->priv[1] && adapter->priv[1]->ndev) {
netif_stop_queue(adapter->priv[1]->ndev);
unregister_netdev(adapter->priv[1]->ndev);
free_netdev(adapter->priv[1]->ndev);
Expand Down