driver: clock_controller: return values of clock_control apis directly.
return values of clock_control_on()/clock_control_get_rate() directly in case overwriting error codes. Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
This commit is contained in:
parent
ad539e5a1c
commit
507f31472c
7 changed files with 57 additions and 35 deletions
|
@ -827,12 +827,14 @@ static int espi_npcx_init(const struct device *dev)
|
|||
struct espi_npcx_data *const data = DRV_DATA(dev);
|
||||
struct espi_reg *const inst = HAL_INSTANCE(dev);
|
||||
const struct device *clk_dev = device_get_binding(NPCX_CLK_CTRL_NAME);
|
||||
int i;
|
||||
int i, ret;
|
||||
|
||||
/* Turn on eSPI device clock first */
|
||||
if (clock_control_on(clk_dev,
|
||||
(clock_control_subsys_t *) &config->clk_cfg) != 0) {
|
||||
return -EIO;
|
||||
ret = clock_control_on(clk_dev, (clock_control_subsys_t *)
|
||||
&config->clk_cfg);
|
||||
if (ret < 0) {
|
||||
LOG_ERR("Turn on eSPI clock fail %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Enable events which share the same espi bus interrupt */
|
||||
|
|
|
@ -757,11 +757,14 @@ int npcx_host_init_subs_core_domain(const struct device *host_bus_dev,
|
|||
host_sub_data.host_bus_dev = host_bus_dev;
|
||||
|
||||
/* Turn on all host necessary sub-module clocks first */
|
||||
for (i = 0; i < host_sub_cfg.clks_size; i++)
|
||||
if (clock_control_on(clk_dev, (clock_control_subsys_t *)
|
||||
&host_sub_cfg.clks_list[i]) != 0) {
|
||||
return -EIO;
|
||||
}
|
||||
for (i = 0; i < host_sub_cfg.clks_size; i++) {
|
||||
int ret;
|
||||
|
||||
ret = clock_control_on(clk_dev, (clock_control_subsys_t *)
|
||||
&host_sub_cfg.clks_list[i]);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Configure EC legacy configuration IO base address to 0x4E. */
|
||||
if (!IS_BIT_SET(inst_mswc->MSWCTL1, NPCX_MSWCTL1_VHCFGA)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue