mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-22 10:39:23 +07:00
can: xilinx_can: handle failure cases of pm_runtime_get_sync
Calling pm_runtime_get_sync increments the counter even in case of
failure, causing incorrect ref count. Call pm_runtime_put if
pm_runtime_get_sync fails.
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Link: https://lore.kernel.org/r/20200605033239.60664-1-navid.emamdoost@gmail.com
Fixes: 4716620d1b
("can: xilinx: Convert to runtime_pm")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
parent
e002103b36
commit
79c43333bd
@ -1395,7 +1395,7 @@ static int xcan_open(struct net_device *ndev)
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
|
netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
return ret;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = request_irq(ndev->irq, xcan_interrupt, priv->irq_flags,
|
ret = request_irq(ndev->irq, xcan_interrupt, priv->irq_flags,
|
||||||
@ -1479,6 +1479,7 @@ static int xcan_get_berr_counter(const struct net_device *ndev,
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
|
netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
|
pm_runtime_put(priv->dev);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1793,7 +1794,7 @@ static int xcan_probe(struct platform_device *pdev)
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
|
netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
goto err_pmdisable;
|
goto err_disableclks;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->read_reg(priv, XCAN_SR_OFFSET) != XCAN_SR_CONFIG_MASK) {
|
if (priv->read_reg(priv, XCAN_SR_OFFSET) != XCAN_SR_CONFIG_MASK) {
|
||||||
@ -1828,7 +1829,6 @@ static int xcan_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
err_disableclks:
|
err_disableclks:
|
||||||
pm_runtime_put(priv->dev);
|
pm_runtime_put(priv->dev);
|
||||||
err_pmdisable:
|
|
||||||
pm_runtime_disable(&pdev->dev);
|
pm_runtime_disable(&pdev->dev);
|
||||||
err_free:
|
err_free:
|
||||||
free_candev(ndev);
|
free_candev(ndev);
|
||||||
|
Loading…
Reference in New Issue
Block a user