Skip to content

Commit 378034c

Browse files
DineshDK03nashif
authored andcommitted
drivers: sensor: grow_r502a: fix in fps_read_template_table
consuming sensor_value struct instead of local device driver variable. Signed-off-by: Dinesh Kumar K <[email protected]>
1 parent 63c48bb commit 378034c

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

drivers/sensor/grow_r502a/grow_r502a.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static int fps_get_template_count(const struct device *dev)
193193
return 0;
194194
}
195195

196-
static int fps_read_template_table(const struct device *dev)
196+
static int fps_read_template_table(const struct device *dev, uint32_t *free_idx)
197197
{
198198
struct grow_r502a_data *drv_data = dev->data;
199199
union r502a_packet rx_packet = {0};
@@ -232,7 +232,7 @@ static int fps_read_template_table(const struct device *dev)
232232
continue;
233233
}
234234

235-
drv_data->free_idx = (group_idx * 8) + find_lsb_set(~group) - 1;
235+
*free_idx = (group_idx * 8) + find_lsb_set(~group) - 1;
236236
goto unlock;
237237
}
238238

@@ -672,8 +672,7 @@ static int grow_r502a_attr_get(const struct device *dev, enum sensor_channel cha
672672
ret = fps_match(dev, val);
673673
break;
674674
case SENSOR_ATTR_R502A_RECORD_FREE_IDX:
675-
ret = fps_read_template_table(dev);
676-
val->val1 = drv_data->free_idx;
675+
ret = fps_read_template_table(dev, &val->val1);
677676
break;
678677
default:
679678
LOG_ERR("Sensor attribute not supported");

drivers/sensor/grow_r502a/grow_r502a.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ struct grow_r502a_data {
190190
uint16_t finger_id;
191191
uint16_t matching_score;
192192
uint16_t template_count;
193-
int8_t free_idx;
194193
};
195194

196195
struct grow_r502a_config {

0 commit comments

Comments
 (0)