[PATCH 2/3] of/flattree: Fix crash when device tree absent

Jeremy Kerr jeremy.kerr at canonical.com
Thu Jul 15 11:11:02 EST 2010


Hi Grant,

> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index d61fda8..66401bc 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -94,6 +94,8 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node,
>  			break;
>  	} while (1);
>  
> +	if (rc)
> +		pr_err("Failed to unflatten device tree blob.  rc=%i\n", rc);
>  	return rc;
>  }

rc == 1 is perfectly valid - it indicates that the iterator callback
stopped the scan early.

How about we just check for the presence of OF_DT_HEADER instead?

Cheers,

Jeremy



More information about the devicetree-discuss mailing list