Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ata: pata_octeon_cf: fix error return code in octeon_cf_probe()

The variable 'rv' is set to 0 after calling of_property_read_reg(), so
it cannot be used as an error code. Change to using correct error codes
in the error path.

Fixes: d0b2461678b1 ("ata: Use of_property_read_reg() to parse "reg"")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>

authored by

Yang Yingliang and committed by
Damien Le Moal
1cfe2d28 4139f992

+3 -3
+3 -3
drivers/ata/pata_octeon_cf.c
··· 815 815 irq_handler_t irq_handler = NULL; 816 816 void __iomem *base; 817 817 struct octeon_cf_port *cf_port; 818 - int rv = -ENOMEM; 819 818 u32 bus_width; 819 + int rv; 820 820 821 821 node = pdev->dev.of_node; 822 822 if (node == NULL) ··· 893 893 cs0 = devm_ioremap(&pdev->dev, res_cs0->start, 894 894 resource_size(res_cs0)); 895 895 if (!cs0) 896 - return rv; 896 + return -ENOMEM; 897 897 898 898 /* allocate host */ 899 899 host = ata_host_alloc(&pdev->dev, 1); 900 900 if (!host) 901 - return rv; 901 + return -ENOMEM; 902 902 903 903 ap = host->ports[0]; 904 904 ap->private_data = cf_port;