diff options
author | Nicola Mazzucato <nicola.mazzucato@arm.com> | 2018-12-21 13:47:48 +0000 |
---|---|---|
committer | ronald-cron-arm <39518861+ronald-cron-arm@users.noreply.github.com> | 2019-01-21 07:15:25 +0000 |
commit | b2830198f65f02a08803a13fa245320fac9e95a4 (patch) | |
tree | 500f01a3db317c893a9b48ba4b96880606f923ef | |
parent | 00e2f8c2123697eaac2a7154342560d643f96880 (diff) |
reg_sensor: Update assertions
Change-Id: I95dbf2777fd1088a5e1d0aa728438687b2952e7d
Signed-off-by: Nicola Mazzucato <nicola.mazzucato@arm.com>
-rw-r--r-- | module/reg_sensor/src/mod_reg_sensor.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/module/reg_sensor/src/mod_reg_sensor.c b/module/reg_sensor/src/mod_reg_sensor.c index 68acf4fb..c6c6119d 100644 --- a/module/reg_sensor/src/mod_reg_sensor.c +++ b/module/reg_sensor/src/mod_reg_sensor.c @@ -72,15 +72,12 @@ static const struct mod_sensor_driver_api reg_sensor_api = { */ static int reg_sensor_init(fwk_id_t module_id, unsigned int element_count, - const void *data) + const void *unused) { config_table = fwk_mm_alloc(element_count, sizeof(*config_table)); - if (config_table == NULL) { - /* Unable to allocate device context memory */ - assert(false); + if (config_table == NULL) return FWK_E_NOMEM; - } return FWK_SUCCESS; } @@ -92,11 +89,8 @@ static int reg_sensor_element_init(fwk_id_t element_id, struct mod_reg_sensor_dev_config *config = (struct mod_reg_sensor_dev_config *)data; - if (config->reg == 0) { - /* Invalid element configuration */ - assert(false); - return FWK_E_PARAM; - } + if (config->reg == 0) + return FWK_E_DATA; config_table[fwk_id_get_element_idx(element_id)] = config; |