* @brief Allocate memory space for struct clock and return it * * @param clk_np point to clock node * @param dev_id device identifier for the clock * @param con_id connection identifier for the clock * @param fw_node point to the firmware node associated with the clock * * @return struct rt_clk* point to clock */
| 78 | * @return struct rt_clk* point to clock |
| 79 | */ |
| 80 | static struct rt_clk *clk_alloc(struct rt_clk_node *clk_np, const char *dev_id, |
| 81 | const char *con_id, void *fw_node) |
| 82 | { |
| 83 | struct rt_clk *clk = rt_calloc(1, sizeof(*clk)); |
| 84 | |
| 85 | if (clk) |
| 86 | { |
| 87 | clk->clk_np = clk_np; |
| 88 | clk->dev_id = dev_id; |
| 89 | clk->con_id = con_id; |
| 90 | |
| 91 | clk->fw_node = fw_node; |
| 92 | } |
| 93 | else |
| 94 | { |
| 95 | clk = rt_err_ptr(-RT_ENOMEM); |
| 96 | } |
| 97 | |
| 98 | return clk; |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * @brief Free memory space of clock object |
no test coverage detected