summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2016-12-19 20:18:45 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-01-18 12:01:38 +0100
commit55d29525146dcd280987dfd565bfd34f08858fb3 (patch)
tree049457f74eb10c0b86f0220c5e6cfe4bd4134705
parent731909c0b4fc98e9492d3a9e3f8bbaa56d457623 (diff)
downloadbarebox-55d29525146dcd280987dfd565bfd34f08858fb3.tar.gz
ata: ide-sff: don't call free for ide_port in error path
The ide_port is provided by the caller so it's not in the responsibility of this function to free this memory in case of error. Actually all callers do the free themselves, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/ata/ide-sff.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/ata/ide-sff.c b/drivers/ata/ide-sff.c
index e32cc3f..6dc89d7 100644
--- a/drivers/ata/ide-sff.c
+++ b/drivers/ata/ide-sff.c
@@ -389,11 +389,10 @@ int ide_port_register(struct ide_port *ide)
ide->port.ops = &ide_ops;
ret = ata_port_register(&ide->port);
- if (!ret)
- ata_port_detect(&ide->port);
-
if (ret)
- free(ide);
+ return ret;
+
+ ata_port_detect(&ide->port);
- return ret;
+ return 0;
}