[U-Boot-Users] [PATCH] Fill in remaining MTD driver data for OneNAND (take #2)

Scott Wood scottwood at freescale.com
Wed Aug 6 18:09:47 CEST 2008


On Wed, Aug 06, 2008 at 10:06:20AM +0200, Fathi BOUDRA wrote:
> -void onenand_print_device_info(int device, int verbose)
> +char * onenand_print_device_info(int device)

No space after unary '*' (here and elsewhere).

>  {
>  	int vcc, demuxed, ddp, density;
> -
> -	if (!verbose)
> -		return;
> +	char *dev_info = (char *)malloc(80);

Don't cast the return of malloc.

Why not just declare a static array?

> -	printk(KERN_INFO "%sOneNAND%s %dMB %sV 16-bit (0x%02x)\n",
> +	sprintf(dev_info, "%sOneNAND%s %dMB %sV 16-bit (0x%02x)",
>  	       demuxed ? "" : "Muxed ",
>  	       ddp ? "(DDP)" : "",
>  	       (16 << density), vcc ? "2.65/3.3" : "1.8", device);

It'd be better to use snprintf, even if you're pretty sure it won't
overflow.

-Scott




More information about the U-Boot mailing list