summaryrefslogtreecommitdiff
path: root/drivers/extcon
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2023-03-22 16:40:01 +0200
committerChanwoo Choi <cw00.choi@samsung.com>2023-05-29 23:41:29 +0900
commit9b4aea51cbcaefacaac655392f360bb3929ab63d (patch)
treed95eeb42900f6bef44eb0c0400e83a9ff1779ebd /drivers/extcon
parent0146f56b91a8ad287e7c94ea340b95a7040d29cf (diff)
extcon: Use dev_of_node(dev) instead of dev->of_node
The dev_of_node function should be preferred. In the result we may drop unneeded NULL check of the pointer to the device object. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/extcon')
-rw-r--r--drivers/extcon/extcon.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 588c552b9525..89b3946b3123 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -1423,21 +1423,17 @@ out:
*/
struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index)
{
- struct device_node *node;
+ struct device_node *node, *np = dev_of_node(dev);
struct extcon_dev *edev;
- if (!dev)
- return ERR_PTR(-EINVAL);
-
- if (!dev->of_node) {
+ if (!np) {
dev_dbg(dev, "device does not have a device node entry\n");
return ERR_PTR(-EINVAL);
}
- node = of_parse_phandle(dev->of_node, "extcon", index);
+ node = of_parse_phandle(np, "extcon", index);
if (!node) {
- dev_dbg(dev, "failed to get phandle in %pOF node\n",
- dev->of_node);
+ dev_dbg(dev, "failed to get phandle in %pOF node\n", np);
return ERR_PTR(-ENODEV);
}