On Mi, 2023-03-15 at 18:44 +0800, Minda Chen wrote: > There is a Cadence USB3 core for JH7110 SoCs, the cdns > core is the child of this USB wrapper module device. > > Signed-off-by: Minda Chen <minda.chen@xxxxxxxxxxxxxxxx> > --- [...] > diff --git a/drivers/usb/cdns3/cdns3-starfive.c b/drivers/usb/cdns3/cdns3-starfive.c > new file mode 100644 > index 000000000000..a99f98f85235 > --- /dev/null > +++ b/drivers/usb/cdns3/cdns3-starfive.c > @@ -0,0 +1,305 @@ [...] > +static int cdns_clk_rst_init(struct cdns_starfive *data) > +{ > + int ret; > + > + data->num_clks = devm_clk_bulk_get_all(data->dev, &data->clks); > + if (data->num_clks < 0) > + return dev_err_probe(data->dev, -ENODEV, > + "Failed to get clocks\n"); > + > + ret = clk_bulk_prepare_enable(data->num_clks, data->clks); > + if (ret) > + return dev_err_probe(data->dev, ret, > + "failed to enable clocks\n"); In general, it's better to acquire all resources first and only then start interacting with them, and to order all devm_ calls before non- devm calls to make sure cleanup is done in reverse order. In this case you can switch clk_bulk_prepare_enable() with devm_reset_control_array_get_exclusive() and simplify the error path. > + data->resets = devm_reset_control_array_get_exclusive(data->dev); > + if (IS_ERR(data->resets)) { > + ret = dev_err_probe(data->dev, PTR_ERR(data->resets), > + "Failed to get resets"); > + goto err_clk_init; > + } > + > + ret = reset_control_deassert(data->resets); > + if (ret) { > + ret = dev_err_probe(data->dev, ret, > + "failed to reset clocks\n"); > + goto err_clk_init; > + } > + > + return ret; > + > +err_clk_init: > + clk_bulk_disable_unprepare(data->num_clks, data->clks); > + return ret; > +} regards Philipp