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

Grant Likely grant.likely at secretlab.ca
Thu Jul 15 16:15:17 EST 2010


On Wed, Jul 14, 2010 at 7:11 PM, Jeremy Kerr <jeremy.kerr at canonical.com> wrote:
> 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.

This was just an informational output anyway.  I'll just drop this hunk.

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

Probably a good idea.  We'll need more robust dtb pointer checking
with ARM.  I'll do that in a separate patch.

g.


More information about the devicetree-discuss mailing list