* [PATCH] tty: serial: 8250: add missing pci_dev_put() before return
@ 2022-02-15 2:00 Qing Wang
2022-02-15 5:55 ` Jiri Slaby
0 siblings, 1 reply; 4+ messages in thread
From: Qing Wang @ 2022-02-15 2:00 UTC (permalink / raw)
To: Andy Shevchenko, Greg Kroah-Hartman, Jiri Slaby, linux-serial,
linux-kernel
Cc: Wang Qing
From: Wang Qing <wangqing@vivo.com>
pci_get_slot() increases its reference count, the caller must
decrement the reference count by calling pci_dev_put()
Signed-off-by: Wang Qing <wangqing@vivo.com>
---
drivers/tty/serial/8250/8250_lpss.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/tty/serial/8250/8250_lpss.c b/drivers/tty/serial/8250/8250_lpss.c
index d3bafec..57e462f
--- a/drivers/tty/serial/8250/8250_lpss.c
+++ b/drivers/tty/serial/8250/8250_lpss.c
@@ -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;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] tty: serial: 8250: add missing pci_dev_put() before return
2022-02-15 2:00 [PATCH] tty: serial: 8250: add missing pci_dev_put() before return Qing Wang
@ 2022-02-15 5:55 ` Jiri Slaby
2022-02-15 6:02 ` Jiri Slaby
0 siblings, 1 reply; 4+ messages in thread
From: Jiri Slaby @ 2022-02-15 5:55 UTC (permalink / raw)
To: Qing Wang, Andy Shevchenko, Greg Kroah-Hartman, linux-serial,
linux-kernel
On 15. 02. 22, 3:00, Qing Wang wrote:
> From: Wang Qing <wangqing@vivo.com>
>
> pci_get_slot() increases its reference count, the caller must
> decrement the reference count by calling pci_dev_put()
>
> Signed-off-by: Wang Qing <wangqing@vivo.com>
> ---
> drivers/tty/serial/8250/8250_lpss.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/tty/serial/8250/8250_lpss.c b/drivers/tty/serial/8250/8250_lpss.c
> index d3bafec..57e462f
> --- a/drivers/tty/serial/8250/8250_lpss.c
> +++ b/drivers/tty/serial/8250/8250_lpss.c
> @@ -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?
> return 0;
> }
>
--
js
suse labs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tty: serial: 8250: add missing pci_dev_put() before return
2022-02-15 5:55 ` Jiri Slaby
@ 2022-02-15 6:02 ` Jiri Slaby
2022-02-15 9:54 ` Andy Shevchenko
0 siblings, 1 reply; 4+ messages in thread
From: Jiri Slaby @ 2022-02-15 6:02 UTC (permalink / raw)
To: Qing Wang, Andy Shevchenko, Greg Kroah-Hartman, linux-serial,
linux-kernel
On 15. 02. 22, 6:55, Jiri Slaby wrote:
> On 15. 02. 22, 3:00, Qing Wang wrote:
>> From: Wang Qing <wangqing@vivo.com>
>>
>> pci_get_slot() increases its reference count, the caller must
>> decrement the reference count by calling pci_dev_put()
>>
>> Signed-off-by: Wang Qing <wangqing@vivo.com>
>> ---
>> drivers/tty/serial/8250/8250_lpss.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/tty/serial/8250/8250_lpss.c
>> b/drivers/tty/serial/8250/8250_lpss.c
>> index d3bafec..57e462f
>> --- a/drivers/tty/serial/8250/8250_lpss.c
>> +++ b/drivers/tty/serial/8250/8250_lpss.c
>> @@ -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,
--
js
suse labs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tty: serial: 8250: add missing pci_dev_put() before return
2022-02-15 6:02 ` Jiri Slaby
@ 2022-02-15 9:54 ` Andy Shevchenko
0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2022-02-15 9:54 UTC (permalink / raw)
To: Jiri Slaby; +Cc: Qing Wang, Greg Kroah-Hartman, linux-serial, linux-kernel
On Tue, Feb 15, 2022 at 07:02:57AM +0100, Jiri Slaby wrote:
> On 15. 02. 22, 6:55, Jiri Slaby wrote:
> > On 15. 02. 22, 3:00, Qing Wang wrote:
> > > From: Wang Qing <wangqing@vivo.com>
> > >
> > > pci_get_slot() increases its reference count, the caller must
> > > decrement the reference count by calling pci_dev_put()
Wang, thank you for the report!
...
> > 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.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-02-15 9:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-15 2:00 [PATCH] tty: serial: 8250: add missing pci_dev_put() before return Qing Wang
2022-02-15 5:55 ` Jiri Slaby
2022-02-15 6:02 ` Jiri Slaby
2022-02-15 9:54 ` Andy Shevchenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.