Skip to content

Commit 1cfe2d2

Browse files
Yang Yingliangdamien-lemoal
authored andcommitted
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: d0b2461 ("ata: Use of_property_read_reg() to parse "reg"") Signed-off-by: Yang Yingliang <[email protected]> Reviewed-by: Sergey Shtylyov <[email protected]> Reviewed-by: Rob Herring <[email protected]> Signed-off-by: Damien Le Moal <[email protected]>
1 parent 4139f99 commit 1cfe2d2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/ata/pata_octeon_cf.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -815,8 +815,8 @@ static int octeon_cf_probe(struct platform_device *pdev)
815815
irq_handler_t irq_handler = NULL;
816816
void __iomem *base;
817817
struct octeon_cf_port *cf_port;
818-
int rv = -ENOMEM;
819818
u32 bus_width;
819+
int rv;
820820

821821
node = pdev->dev.of_node;
822822
if (node == NULL)
@@ -893,12 +893,12 @@ static int octeon_cf_probe(struct platform_device *pdev)
893893
cs0 = devm_ioremap(&pdev->dev, res_cs0->start,
894894
resource_size(res_cs0));
895895
if (!cs0)
896-
return rv;
896+
return -ENOMEM;
897897

898898
/* allocate host */
899899
host = ata_host_alloc(&pdev->dev, 1);
900900
if (!host)
901-
return rv;
901+
return -ENOMEM;
902902

903903
ap = host->ports[0];
904904
ap->private_data = cf_port;

0 commit comments

Comments
 (0)