Re: [PATCH v2 2/2] usb: roles: get usb role switch from parent only for usb-b-connector
From: Frank Li
Date: Mon Mar 09 2026 - 15:55:15 EST
From: Frank Li (AI-BOT) <frank.li@xxxxxxx>
> if (!fwnode_device_is_compatible(fwnode, "usb-b-connector"))
> return NULL;
AI: Nit: inconsistent indentation. Should use a single tab, not two spaces.
Use '\t' for the return statement to match kernel style.
> parent = fwnode_get_parent(fwnode);
>
> if (!fwnode_property_present(parent, "usb-role-switch")) {
AI: Missing NULL check on parent before passing to fwnode_property_present().
If fwnode_get_parent() returns NULL, the next call will dereference it.
Add: if (!parent) return NULL;
Frank