mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] pci: pci_alloc_bus(): use xzalloc() instead of kzalloc()
@ 2014-07-08 20:23 Antony Pavlov
  2014-07-09  5:32 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Antony Pavlov @ 2014-07-08 20:23 UTC (permalink / raw)
  To: barebox

Also drop redundant xzalloc() result check
as xzalloc() does not return in case of memory allocation error.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 drivers/pci/pci.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index ad9350f..3d88b0f 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -16,14 +16,14 @@ static struct pci_bus *pci_alloc_bus(void)
 {
 	struct pci_bus *b;
 
-	b = kzalloc(sizeof(*b), GFP_KERNEL);
-	if (b) {
-		INIT_LIST_HEAD(&b->node);
-		INIT_LIST_HEAD(&b->children);
-		INIT_LIST_HEAD(&b->devices);
-		INIT_LIST_HEAD(&b->slots);
-		INIT_LIST_HEAD(&b->resources);
-	}
+	b = xzalloc(sizeof(*b));
+
+	INIT_LIST_HEAD(&b->node);
+	INIT_LIST_HEAD(&b->children);
+	INIT_LIST_HEAD(&b->devices);
+	INIT_LIST_HEAD(&b->slots);
+	INIT_LIST_HEAD(&b->resources);
+
 	return b;
 }
 
-- 
2.0.1


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

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

* Re: [PATCH] pci: pci_alloc_bus(): use xzalloc() instead of kzalloc()
  2014-07-08 20:23 [PATCH] pci: pci_alloc_bus(): use xzalloc() instead of kzalloc() Antony Pavlov
@ 2014-07-09  5:32 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2014-07-09  5:32 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: barebox

On Wed, Jul 09, 2014 at 12:23:11AM +0400, Antony Pavlov wrote:
> Also drop redundant xzalloc() result check
> as xzalloc() does not return in case of memory allocation error.
> 
> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>

Applied, thanks

Sascha

> ---
>  drivers/pci/pci.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index ad9350f..3d88b0f 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -16,14 +16,14 @@ static struct pci_bus *pci_alloc_bus(void)
>  {
>  	struct pci_bus *b;
>  
> -	b = kzalloc(sizeof(*b), GFP_KERNEL);
> -	if (b) {
> -		INIT_LIST_HEAD(&b->node);
> -		INIT_LIST_HEAD(&b->children);
> -		INIT_LIST_HEAD(&b->devices);
> -		INIT_LIST_HEAD(&b->slots);
> -		INIT_LIST_HEAD(&b->resources);
> -	}
> +	b = xzalloc(sizeof(*b));
> +
> +	INIT_LIST_HEAD(&b->node);
> +	INIT_LIST_HEAD(&b->children);
> +	INIT_LIST_HEAD(&b->devices);
> +	INIT_LIST_HEAD(&b->slots);
> +	INIT_LIST_HEAD(&b->resources);
> +
>  	return b;
>  }
>  
> -- 
> 2.0.1
> 
> 
> _______________________________________________
> 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] 2+ messages in thread

end of thread, other threads:[~2014-07-09  5:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-08 20:23 [PATCH] pci: pci_alloc_bus(): use xzalloc() instead of kzalloc() Antony Pavlov
2014-07-09  5:32 ` Sascha Hauer

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