mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ata: ide-sff: don't call free for ide_port in error path
@ 2016-12-19 19:18 Uwe Kleine-König
  2017-01-09 10:27 ` Sascha Hauer
  2017-01-18 11:01 ` Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2016-12-19 19:18 UTC (permalink / raw)
  To: barebox

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>
---
 drivers/ata/ide-sff.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/ata/ide-sff.c b/drivers/ata/ide-sff.c
index e32cc3fc24f8..6dc89d79a543 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;
 }
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ata: ide-sff: don't call free for ide_port in error path
  2016-12-19 19:18 [PATCH] ata: ide-sff: don't call free for ide_port in error path Uwe Kleine-König
@ 2017-01-09 10:27 ` Sascha Hauer
  2017-01-18 11:01 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2017-01-09 10:27 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: barebox

On Mon, Dec 19, 2016 at 08:18:45PM +0100, Uwe Kleine-König wrote:
> 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>
> ---

Applied, thanks

Sascha

>  drivers/ata/ide-sff.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/ata/ide-sff.c b/drivers/ata/ide-sff.c
> index e32cc3fc24f8..6dc89d79a543 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;
>  }
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ata: ide-sff: don't call free for ide_port in error path
  2016-12-19 19:18 [PATCH] ata: ide-sff: don't call free for ide_port in error path Uwe Kleine-König
  2017-01-09 10:27 ` Sascha Hauer
@ 2017-01-18 11:01 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2017-01-18 11:01 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: barebox

On Mon, Dec 19, 2016 at 08:18:45PM +0100, Uwe Kleine-König wrote:
> 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>
> ---
>  drivers/ata/ide-sff.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/ata/ide-sff.c b/drivers/ata/ide-sff.c
> index e32cc3fc24f8..6dc89d79a543 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;
>  }
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-18 11:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-19 19:18 [PATCH] ata: ide-sff: don't call free for ide_port in error path Uwe Kleine-König
2017-01-09 10:27 ` Sascha Hauer
2017-01-18 11:01 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox