Skip to content

Commit

Permalink
staging/fwserial: Destruct embedded tty_port on teardown
Browse files Browse the repository at this point in the history
For TTY drivers that manage the port lifetime, the tty_port should
to be specifically destructed when the port lifetime ends. Now that
a method has been added to do this, use it.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Alan Cox <alan@linux.intel.com>
  • Loading branch information
Peter Hurley authored and Greg Kroah-Hartman committed Nov 28, 2012
1 parent eef6e7b commit a321846
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/staging/fwserial/fwserial.c
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,7 @@ static void fwserial_destroy(struct kref *kref)
for (j = 0; j < num_ports; ++j) {
fw_core_remove_address_handler(&ports[j]->rx_handler);
dma_fifo_free(&ports[j]->tx_fifo);
tty_port_destroy(&ports[j]->port);
kfree(ports[j]);
}
kfree(serial);
Expand Down Expand Up @@ -2369,8 +2370,10 @@ static int fwserial_create(struct fw_unit *unit)
return err;

free_ports:
for (--i; i >= 0; --i)
for (--i; i >= 0; --i) {
tty_port_destroy(&serial->ports[i]->port);
kfree(serial->ports[i]);
}
kfree(serial);
return err;
}
Expand Down

0 comments on commit a321846

Please sign in to comment.