Re: [PATCH v3 1/1] usb: dwc3: Add optional VBUS regulator support to SpacemiT K1

From: Chukun Pan

Date: Tue Mar 31 2026 - 09:02:58 EST


Hi,

> > + if (usb_get_dr_mode(dev) == USB_DR_MODE_HOST) {
> The logic looks good, but the structure can be further improved to better align with
> standard kernel coding style:
>
> if (usb_get_dr_mode(dev) != USB_DR_MODE_HOST)
> return 0;

I initially thought of writing it this way too.

> > + int ret = devm_regulator_get_enable_optional(dev, "vbus");
> Could you please move the declaration of ret to the top of the function?

Thank you for your suggestion. This patch has been merged.
Perhaps it can be revised in the future.

Thanks,
Chukun