]> git.baikalelectronics.ru Git - kernel.git/commit
of: Check 'of_node_reused' flag on of_match_device()
authorRob Herring <robh@kernel.org>
Tue, 18 Jan 2022 17:34:04 +0000 (11:34 -0600)
committerRob Herring <robh@kernel.org>
Thu, 20 Jan 2022 18:55:26 +0000 (12:55 -0600)
commit4363b68155c8070ab3da4a69d3f6da72a5ae2ff4
tree900e9b138f1bd0320431a14161557c8da6ce17be
parentf98a900d37fa65f9471e8c3cc91a9832b402179d
of: Check 'of_node_reused' flag on of_match_device()

Commit b110b43e8fb3 ("usb: chipidea: Set the DT node on the child
device") caused the child device to match on the parent driver
instead of the child's driver since the child's DT node pointer matched.
The worst case result is a loop of the parent driver probing another
instance and creating yet another child device eventually exhausting the
stack. If the child driver happens to match first, then everything works
fine.

A device sharing the DT node should never do DT based driver matching,
so let's simply check of_node_reused in of_match_device() to prevent
that.

Fixes: b110b43e8fb3 ("usb: chipidea: Set the DT node on the child device")
Link: https://lore.kernel.org/all/20220114105620.GK18506@ediswmail.ad.cirrus.com/
Reported-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: Frank Rowand <frowand.list@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Peter Chen <peter.chen@nxp.com>
Tested-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220118173404.1891800-1-robh@kernel.org
drivers/of/device.c