With HAL ABI versioning, the hal_backend_sensor_funcs, which is a
container of sensor backend functions is allocated from hal-api-sensor.
Thus, it is modified to use hal_backend_sensor_funcs allocated from the
caller(hal-api-sensor).
Change-Id: I6ad5c106f6848d8a2064ede8d90bfb5eb11e4adf
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
static int sensor_emulator_init(void **data) {
_I("init hal backend sensor");
- hal_backend_sensor_funcs *funcs;
+ hal_backend_sensor_funcs *funcs = NULL;
- funcs =
- (hal_backend_sensor_funcs *)calloc(1, sizeof(hal_backend_sensor_funcs));
- if (!funcs) return -ENOMEM;
+ if (!data) {
+ _E("Invalid parameter");
+ return -EINVAL;
+ }
- funcs->create = sensor_emulator_create;
+ funcs = *((hal_backend_sensor_funcs **)data);
+ if (!funcs) {
+ _E("Invalid parameter");
+ return -EINVAL;
+ }
- *data = (void *)funcs;
+ funcs->create = sensor_emulator_create;
return 0;
}
static int sensor_emulator_exit(void *data) {
- if (!data) return -EINVAL;
- free(data);
-
return 0;
}