Skip to content

Commit 10d6bdf

Browse files
YuuoniyDamien Le Moal
authored andcommitted
ata: pata_octeon_cf: Fix refcount leak in octeon_cf_probe
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: 43f01da ("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>
1 parent bf476fe commit 10d6bdf

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/ata/pata_octeon_cf.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,12 +856,14 @@ static int octeon_cf_probe(struct platform_device *pdev)
856856
int i;
857857
res_dma = platform_get_resource(dma_dev, IORESOURCE_MEM, 0);
858858
if (!res_dma) {
859+
put_device(&dma_dev->dev);
859860
of_node_put(dma_node);
860861
return -EINVAL;
861862
}
862863
cf_port->dma_base = (u64)devm_ioremap(&pdev->dev, res_dma->start,
863864
resource_size(res_dma));
864865
if (!cf_port->dma_base) {
866+
put_device(&dma_dev->dev);
865867
of_node_put(dma_node);
866868
return -EINVAL;
867869
}
@@ -871,6 +873,7 @@ static int octeon_cf_probe(struct platform_device *pdev)
871873
irq = i;
872874
irq_handler = octeon_cf_interrupt;
873875
}
876+
put_device(&dma_dev->dev);
874877
}
875878
of_node_put(dma_node);
876879
}

0 commit comments

Comments
 (0)