[PATCH v5 3/7] PCI: initial commit

Sascha Hauer s.hauer at pengutronix.de
Mon Jul 7 23:29:34 PDT 2014


On Tue, Jul 08, 2014 at 01:23:46AM +0400, Antony Pavlov wrote:
> On Mon, 7 Jul 2014 20:22:10 +0200
> Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com> wrote:
> 
> > > +static struct pci_bus *pci_alloc_bus(void)
> > > +{
> > > +	struct pci_bus *b;
> > > +
> > > +	b = kzalloc(sizeof(*b), GFP_KERNEL);
> > 
> > 	if (!b)
> > 		return b;
> 
> kzalloc() eventually calls xmalloc().
> xmalloc() calls panic() if malloc fails, so there is no need to check b at all.

Then let's use xzalloc directly here. I think only the x functions
should panic on failure. kzalloc should be implemented with
malloc or calloc.

Sascha

-- 
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 |



More information about the barebox mailing list