]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
w1-eeprom: ds24xxx: fix data abort in ds24xxx_probe()
authorMartin Fuzzey <martin.fuzzey@flowbird.group>
Mon, 22 Oct 2018 16:31:07 +0000 (18:31 +0200)
committerTom Rini <trini@konsulko.com>
Thu, 1 Nov 2018 14:02:10 +0000 (10:02 -0400)
Data abort was occurring when using "w1 bus" with a DS24B33 present.

The abort occurred in the ds24xxx_probe() because the struct w1_device
pointer was NULL. This is because that structure  is allocated by
the parent device uclass (by .per_child_platdata_auto_alloc_size)
and thus the correct accessor is dev_get_parent_platdata() not
dev_get_platdata()

Signed-off-by: Martin Fuzzey <martin.fuzzey@flowbird.group>
Reviewed-by: Eugen Hristev <eugen.hristev@microchip.com>
drivers/w1-eeprom/ds24xxx.c

index 56186e587cf50bf62b39ac3147d8732dc30ca752..0967accdf0095c3883eda1aa1f2bf3d0f82402f2 100644 (file)
@@ -31,7 +31,7 @@ static int ds24xxx_probe(struct udevice *dev)
 {
        struct w1_device *w1;
 
-       w1 = dev_get_platdata(dev);
+       w1 = dev_get_parent_platdata(dev);
        w1->id = 0;
        return 0;
 }