]> git.karo-electronics.de Git - karo-tx-uboot.git/commit
dm: core: Fix code reentrancy issue in device_probe_child()
authorBin Meng <bmeng.cn@gmail.com>
Mon, 24 Aug 2015 08:14:02 +0000 (01:14 -0700)
committerLothar Waßmann <LW@KARO-electronics.de>
Thu, 10 Sep 2015 09:29:48 +0000 (11:29 +0200)
commit1802626719f4b42ee1743e75de7a9c1e6f2c1e06
tree0d4d3edcbc2156cc4dc985df66bf5240d56839bc
parent01ec422665b32191b940a355ebc6bb107fa9e8e7
dm: core: Fix code reentrancy issue in device_probe_child()

The device might have already been probed during the call to
device_probe() on its parent device (e.g. PCI bridge devices).
In its parent device's probe routine, it might probe all of
its child devices via device_probe() thus the codes reenter
device_probe_child(). To support code reentrancy, test these
allocated memory against NULL to avoid memory leak, and return
to the caller if dev->flags has DM_FLAG_ACTIVATED set after
device_probe() returns, so that we don't mess up the device.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
drivers/core/device.c