diff options
author | Nicola Mazzucato <nicola.mazzucato@arm.com> | 2020-03-20 11:54:56 +0000 |
---|---|---|
committer | jimqui01 <54316584+jimqui01@users.noreply.github.com> | 2020-04-03 12:51:34 +0100 |
commit | d16ebb7cbae444a9653a6aebe45957a36d137717 (patch) | |
tree | 6a9f7e6323dcfc915f3afe97378b4b2dfb6aa341 | |
parent | 264b0e29b2a12550802fd59eb18334e4906c7d41 (diff) |
clock: Simplify get_ctx() function
Currently get_ctx always return success. With this
patch the function does not return any status and
the redundant checks are removed.
Change-Id: Iccc20e99b4ce1b2bc118e47e8d8f1bfba557552a
Signed-off-by: Nicola Mazzucato <nicola.mazzucato@arm.com>
-rw-r--r-- | module/clock/src/mod_clock.c | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/module/clock/src/mod_clock.c b/module/clock/src/mod_clock.c index 19eba164..2762e121 100644 --- a/module/clock/src/mod_clock.c +++ b/module/clock/src/mod_clock.c @@ -124,13 +124,11 @@ static int create_async_request(struct clock_dev_ctx *ctx, fwk_id_t clock_id) return FWK_PENDING; } -static int get_ctx(fwk_id_t clock_id, struct clock_dev_ctx **ctx) +static void get_ctx(fwk_id_t clock_id, struct clock_dev_ctx **ctx) { fwk_assert(fwk_module_is_valid_element_id(clock_id)); *ctx = &module_ctx.dev_ctx_table[fwk_id_get_element_idx(clock_id)]; - - return FWK_SUCCESS; } /* @@ -180,9 +178,7 @@ static int clock_set_rate(fwk_id_t clock_id, uint64_t rate, int status; struct clock_dev_ctx *ctx; - status = get_ctx(clock_id, &ctx); - if (status != FWK_SUCCESS) - return status; + get_ctx(clock_id, &ctx); /* Concurrency is not supported */ if (ctx->is_request_ongoing) @@ -200,9 +196,7 @@ static int clock_get_rate(fwk_id_t clock_id, uint64_t *rate) int status; struct clock_dev_ctx *ctx; - status = get_ctx(clock_id, &ctx); - if (status != FWK_SUCCESS) - return status; + get_ctx(clock_id, &ctx); if (rate == NULL) return FWK_E_PARAM; @@ -221,12 +215,9 @@ static int clock_get_rate(fwk_id_t clock_id, uint64_t *rate) static int clock_get_rate_from_index(fwk_id_t clock_id, unsigned int rate_index, uint64_t *rate) { - int status; struct clock_dev_ctx *ctx; - status = get_ctx(clock_id, &ctx); - if (status != FWK_SUCCESS) - return status; + get_ctx(clock_id, &ctx); if (rate == NULL) return FWK_E_PARAM; @@ -240,9 +231,7 @@ static int clock_set_state(fwk_id_t clock_id, enum mod_clock_state state) int status; struct clock_dev_ctx *ctx; - status = get_ctx(clock_id, &ctx); - if (status != FWK_SUCCESS) - return status; + get_ctx(clock_id, &ctx); /* Concurrency is not supported */ if (ctx->is_request_ongoing) @@ -260,9 +249,7 @@ static int clock_get_state(fwk_id_t clock_id, enum mod_clock_state *state) int status; struct clock_dev_ctx *ctx; - status = get_ctx(clock_id, &ctx); - if (status != FWK_SUCCESS) - return status; + get_ctx(clock_id, &ctx); if (state == NULL) return FWK_E_PARAM; @@ -283,9 +270,7 @@ static int clock_get_info(fwk_id_t clock_id, struct mod_clock_info *info) int status; struct clock_dev_ctx *ctx; - status = get_ctx(clock_id, &ctx); - if (status != FWK_SUCCESS) - return status; + get_ctx(clock_id, &ctx); if (info == NULL) return FWK_E_PARAM; |