lkml.org 
[lkml]   [2022]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.19 236/287] ata: pata_octeon_cf: Fix refcount leak in octeon_cf_probe
    Date
    From: Miaoqian Lin <linmq006@gmail.com>

    [ Upstream commit 10d6bdf532902be1d8aa5900b3c03c5671612aa2 ]

    of_find_device_by_node() takes reference, we should use put_device()
    to release it when not need anymore.
    Add missing put_device() to avoid refcount leak.

    Fixes: 43f01da0f279 ("MIPS/OCTEON/ata: Convert pata_octeon_cf.c to use device tree.")
    Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
    Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
    Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/ata/pata_octeon_cf.c | 3 +++
    1 file changed, 3 insertions(+)

    diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
    index ac3b1fda820f..c240d8cbfd41 100644
    --- a/drivers/ata/pata_octeon_cf.c
    +++ b/drivers/ata/pata_octeon_cf.c
    @@ -888,12 +888,14 @@ static int octeon_cf_probe(struct platform_device *pdev)
    int i;
    res_dma = platform_get_resource(dma_dev, IORESOURCE_MEM, 0);
    if (!res_dma) {
    + put_device(&dma_dev->dev);
    of_node_put(dma_node);
    return -EINVAL;
    }
    cf_port->dma_base = (u64)devm_ioremap_nocache(&pdev->dev, res_dma->start,
    resource_size(res_dma));
    if (!cf_port->dma_base) {
    + put_device(&dma_dev->dev);
    of_node_put(dma_node);
    return -EINVAL;
    }
    @@ -903,6 +905,7 @@ static int octeon_cf_probe(struct platform_device *pdev)
    irq = i;
    irq_handler = octeon_cf_interrupt;
    }
    + put_device(&dma_dev->dev);
    }
    of_node_put(dma_node);
    }
    --
    2.35.1


    \
     
     \ /
      Last update: 2022-06-13 14:21    [W:6.248 / U:0.044 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site