The CONFIG_OF maybe set, but it may not be applicable to a device. In such case, checking against that can cause the device fail to initialize. Check against the device node (device->of_node) instead. Fixes: a102f07e4edf ("usb: dwc3: drd: Add support for usb-conn-gpio based usb-role-switch") Signed-off-by: Thinh Nguyen <Thinh.Nguyen@xxxxxxxxxxxx> --- Note: This patch should go on Greg's "usb-testing" branch as the commit it fixes is not in mainline yet. drivers/usb/dwc3/drd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c index 25f322e62d3f..b60b5f7b6dff 100644 --- a/drivers/usb/dwc3/drd.c +++ b/drivers/usb/dwc3/drd.c @@ -560,7 +560,7 @@ static int dwc3_setup_role_switch(struct dwc3 *dwc) if (IS_ERR(dwc->role_sw)) return PTR_ERR(dwc->role_sw); - if (IS_ENABLED(CONFIG_OF)) { + if (dwc->dev->of_node) { /* populate connector entry */ int ret = devm_of_platform_populate(dwc->dev); base-commit: 9902951f536c00b7f20c26fd98baa5432bb3c731 -- 2.28.0