Commit 67ec6dd0 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman

serial: 8250_mid: Balance reference count for PCI DMA device

The pci_get_slot() increases its reference count, the caller
must decrement the reference count by calling pci_dev_put().

Fixes: 90b9aacf ("serial: 8250_pci: add Intel Tangier support")
Fixes: f549e94e ("serial: 8250_pci: add Intel Penwell ports")
Reported-by: default avatarQing Wang <wangqing@vivo.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Depends-on: d9eda9ba ("serial: 8250_pci: Intel MID UART support to its own driver")
Link: https://lore.kernel.org/r/20220215100920.41984-1-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c5e453f9
...@@ -73,6 +73,11 @@ static int pnw_setup(struct mid8250 *mid, struct uart_port *p) ...@@ -73,6 +73,11 @@ static int pnw_setup(struct mid8250 *mid, struct uart_port *p)
return 0; return 0;
} }
static void pnw_exit(struct mid8250 *mid)
{
pci_dev_put(mid->dma_dev);
}
static int tng_handle_irq(struct uart_port *p) static int tng_handle_irq(struct uart_port *p)
{ {
struct mid8250 *mid = p->private_data; struct mid8250 *mid = p->private_data;
...@@ -124,6 +129,11 @@ static int tng_setup(struct mid8250 *mid, struct uart_port *p) ...@@ -124,6 +129,11 @@ static int tng_setup(struct mid8250 *mid, struct uart_port *p)
return 0; return 0;
} }
static void tng_exit(struct mid8250 *mid)
{
pci_dev_put(mid->dma_dev);
}
static int dnv_handle_irq(struct uart_port *p) static int dnv_handle_irq(struct uart_port *p)
{ {
struct mid8250 *mid = p->private_data; struct mid8250 *mid = p->private_data;
...@@ -328,9 +338,9 @@ static int mid8250_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -328,9 +338,9 @@ static int mid8250_probe(struct pci_dev *pdev, const struct pci_device_id *id)
pci_set_drvdata(pdev, mid); pci_set_drvdata(pdev, mid);
return 0; return 0;
err: err:
if (mid->board->exit) mid->board->exit(mid);
mid->board->exit(mid);
return ret; return ret;
} }
...@@ -340,8 +350,7 @@ static void mid8250_remove(struct pci_dev *pdev) ...@@ -340,8 +350,7 @@ static void mid8250_remove(struct pci_dev *pdev)
serial8250_unregister_port(mid->line); serial8250_unregister_port(mid->line);
if (mid->board->exit) mid->board->exit(mid);
mid->board->exit(mid);
} }
static const struct mid8250_board pnw_board = { static const struct mid8250_board pnw_board = {
...@@ -349,6 +358,7 @@ static const struct mid8250_board pnw_board = { ...@@ -349,6 +358,7 @@ static const struct mid8250_board pnw_board = {
.freq = 50000000, .freq = 50000000,
.base_baud = 115200, .base_baud = 115200,
.setup = pnw_setup, .setup = pnw_setup,
.exit = pnw_exit,
}; };
static const struct mid8250_board tng_board = { static const struct mid8250_board tng_board = {
...@@ -356,6 +366,7 @@ static const struct mid8250_board tng_board = { ...@@ -356,6 +366,7 @@ static const struct mid8250_board tng_board = {
.freq = 38400000, .freq = 38400000,
.base_baud = 1843200, .base_baud = 1843200,
.setup = tng_setup, .setup = tng_setup,
.exit = tng_exit,
}; };
static const struct mid8250_board dnv_board = { static const struct mid8250_board dnv_board = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment