tty: serial: 8250: add missing pci_dev_put() before return
PATCH 1/1 tty: serial: 8250: add missing pci_dev_put() before return
From: Wang Qing <[email protected]>
pci_get_slot() increases its reference count, the caller must decrement the reference count by calling pci_dev_put()
--- drivers/tty/serial/8250/8250_lpss.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/tty/serial/8250/8250_lpss.c +2 -0
@@ -149,6 +149,8 @@ static int byt_serial_setup(struct lpss8250 *lpss, struct uart_port *port)/* Disable TX counter interrupts */ writel (BYT_TX_OVF_INT_MASK , port->membase +BYT_TX_OVF_INT ); +pci_dev_put (dma_dev); +return 0 ; }
Signature · 1 line
2.7.4
Jiri Slaby
maintainerQuoted 15 lines · Qing Wang
From: Wang Qing <[email protected]>
pci_get_slot()increases its reference count, the caller must decrement the reference count by callingpci_dev_put()Signed-off-by Wang Qing <[email protected]>--- drivers/tty/serial/8250/8250_lpss.c | 2 ++ 1 file changed, 2 insertions(+)drivers/tty/serial/8250/8250_lpss.c +0
-0
drivers/tty/serial/8250/8250_lpss.c static int byt_serial_setup(struct lpss8250 *lpss, struct uart_port *port) · line 152
Quoted 4 lines
drivers/tty/serial/8250/8250_lpss.c +1
-0@@ -149,6 +149,8 @@ static int byt_serial_setup(struct lpss8250 *lpss, struct uart_port *port)/* Disable TX counter interrupts */ writel (BYT_TX_OVF_INT_MASK , port->membase +BYT_TX_OVF_INT ); +pci_dev_put (dma_dev);
What about the "return -ENODEV" few lines above?
Quoted 3 lines
drivers/tty/serial/8250/8250_lpss.c +0
-0return 0 ; }
Signature · 2 lines
js suse labs
Jiri Slaby
maintainerQuoted 11 lines · Jiri Slaby
Quoted 10 lines · Qing Wang
From: Wang Qing <[email protected]>
pci_get_slot()increases its reference count, the caller must decrement the reference count by callingpci_dev_put()Signed-off-by Wang Qing <[email protected]>---
drivers/tty/serial/8250/8250_lpss.c| 2 ++1 file changed, 2 insertions(+)
Quoted 12 lines
drivers/tty/serial/8250/8250_lpss.c static int byt_serial_setup(struct lpss8250 *lpss, · line 152
Quoted 9 lines
drivers/tty/serial/8250/8250_lpss.c +1
-0@@ -149,6 +149,8 @@ static int byt_serial_setup(struct lpss8250 *lpss, struct uart_port *port) /* Disable TX counter interrupts */ writel(BYT_TX_OVF_INT_MASK, port->membase + BYT_TX_OVF_INT); + pci_dev_put(dma_dev);What about the "return
-ENODEV" few lines above?
On the top of that, the code stores the pointer to the dev:param->dma_dev = &dma_dev->dev;
So we should likely put the device in ->exit(), not ->setup().
thanks,
Signature · 2 lines
js suse labs
Andy Shevchenko
reviewerQuoted 6 lines · Jiri Slaby
Quoted 5 lines · Jiri Slaby
Quoted 4 lines · Qing Wang
From: Wang Qing <[email protected]>
pci_get_slot()increases its reference count, the caller must decrement the reference count by callingpci_dev_put()
Wang, thank you for the report!
...
Quoted 6 lines
Quoted 1 line
What about the "return
-ENODEV" few lines above?On the top of that, the code stores the pointer to the dev:
param->dma_dev=&dma_dev->dev;So we should likely put the device in ->exit(), not ->setup().
I think I may fix all these and send a new version.
Signature · 2 lines
With Best Regards, Andy Shevchenko