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

Peng Fan peng.fan at nxp.com
Mon Jul 22 01:05:08 UTC 2019


Hi Igor

> Subject: pmic_get() broken after 4213609cc7("drivers: core: use strcmp when
> find device by name")
> 
> 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?

I think need to fix all users of uclass_find_device_by_name with passing the real
device name, but not part of the name.

Regards,
Peng.

> 
> 
> --
> Best regards - Freundliche GrĂ¼sse - Meilleures salutations
> 
> Igor Opaniuk
> 
> mailto: igor.opaniuk at gmail.com
> skype: igor.opanyuk
> +380 (93) 836 40 67
> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fua.linke
> din.com%2Fin%2Fiopaniuk&data=02%7C01%7Cpeng.fan%40nxp.com%7
> C836e8e55dd96453858a008d70c49d407%7C686ea1d3bc2b4c6fa92cd99c5c
> 301635%7C0%7C0%7C636991383533016404&sdata=yKTqMEPO9OY%2
> FRioLKVU6ZYBZSqqh6IxfMkQLxzRCzjo%3D&reserved=0


More information about the U-Boot mailing list