From: Olivier Blin Date: Fri, 8 Aug 2008 19:01:41 +0000 (-0700) Subject: hso: fix refcounting on the ttyHSx devices X-Git-Tag: v2.6.27-rc4~39^2~48^2~6 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=6d558a52ba295fc1c281c671d7daab2f74ddb4f2;p=linux-2.6-omap-h63xx.git hso: fix refcounting on the ttyHSx devices The references on ttyHSx devices were not decremented correctly when the tty was closed. The helper freeing the serial devices was never called because of that, and the module left some dangling sysfs devices after being unloaded. Signed-off-by: Olivier Blin Cc: Jari Tenhunen Signed-off-by: Greg Kroah-Hartman Signed-off-by: Jeff Garzik --- diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index 94a27f764e6..94c41bbedee 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c @@ -1103,8 +1103,8 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp) /* reset the rts and dtr */ /* do the actual close */ serial->open_count--; + kref_put(&serial->parent->ref, hso_serial_ref_free); if (serial->open_count <= 0) { - kref_put(&serial->parent->ref, hso_serial_ref_free); serial->open_count = 0; if (serial->tty) { serial->tty->driver_data = NULL;