Skip to content

Commit

Permalink
serial: 8250-mtk: Fix reference leak in mtk8250_probe
Browse files Browse the repository at this point in the history
[ Upstream commit 6e4e636 ]

The pm_runtime_enable will increase power disable depth.
Thus a pairing decrement is needed on the error handling
path to keep it balanced according to context.

Fixes: e32a83c ("serial: 8250-mtk: modify mtk uart power and clock management")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Link: https://lore.kernel.org/r/20201119141126.168850-1-zhangqilong3@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Zhang Qilong authored and gregkh committed Dec 30, 2020
1 parent af7ae24 commit 048a04a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions drivers/tty/serial/8250/8250_mtk.c
Expand Up @@ -572,15 +572,22 @@ static int mtk8250_probe(struct platform_device *pdev)
pm_runtime_enable(&pdev->dev);
err = mtk8250_runtime_resume(&pdev->dev);
if (err)
return err;
goto err_pm_disable;

data->line = serial8250_register_8250_port(&uart);
if (data->line < 0)
return data->line;
if (data->line < 0) {
err = data->line;
goto err_pm_disable;
}

data->rx_wakeup_irq = platform_get_irq_optional(pdev, 1);

return 0;

err_pm_disable:
pm_runtime_disable(&pdev->dev);

return err;
}

static int mtk8250_remove(struct platform_device *pdev)
Expand Down

0 comments on commit 048a04a

Please sign in to comment.