[U-Boot] pmic_get() broken after 4213609cc7("drivers: core: use strcmp when find device by name")

Igor Opaniuk igor.opaniuk at gmail.com
Fri Jul 19 13:05:40 UTC 2019


Hi,

Today found out that U-boot isn't booting anymore on Colibri iMX7 and
hangs with:
U-Boot 2019.07-00788-g0ef6e69a1e-dirty (Jul 19 2019 - 15:27:02 +0300)

CPU:   Freescale i.MX7D rev1.3 1000 MHz (running at 792 MHz)
CPU:   Extended Commercial temperature grade (-20C to 105C) at 41C
Reset cause: POR
DRAM:  512 MiB
initcall sequence 9ffd3a4c failed at call 87803c61 (err=-19)
### ERROR ### Please RESET the board ###


Bisected to 4213609cc7("drivers: core: use strcmp when find device by name"),
which changes the behavior of uclass_find_device_by_name().

The problem is that implementation of pmic_get() from
drivers/power/pmic/pmic-uclass.c
calls this changed uclass_find_device_by_name(), and as a param
supplies node name
without unit address (just checked it out, seems this how it's used on
a lot of platforms,
`grep -e pmic_get -r --include *.c ./` , so I assume that not only one
platform is broken now).

In our case the node is defined as:

rn5t567 at 33 {
    compatible = "ricoh,rn5t567";
    reg = <0x33>;
};

and after pmic_get("rn5t567"), in uclass_find_device_by_name():

uclass_foreach_dev(dev, uc) {
    if (!strcmp(dev->name, name)) {
        *devp = dev;
         return 0;
}

now dev->name == "rn5t567 at 33", name == "rn5t567", and it never finds a
proper device.

The question is: should this be addressed but changingall invocations
of pmic_get() (by concatenating to the string
a proper unit address), and should we re-implement pmic_get(), so it
can accept as a param only
a node name without unit address?


-- 
Best regards - Freundliche GrĂ¼sse - Meilleures salutations

Igor Opaniuk

mailto: igor.opaniuk at gmail.com
skype: igor.opanyuk
+380 (93) 836 40 67
http://ua.linkedin.com/in/iopaniuk


More information about the U-Boot mailing list