Skip to content

Commit e807c40

Browse files
robherringgregkh
authored andcommitted
misc: lis3lv02d: Fix incorrect of_get_property() usage
The usage of of_get_property() is wrong. What's returned in "val" is the property's length, not the value. Fix this by using the preferred typed of_property_read_u32() function instead. Signed-off-by: Rob Herring (Arm) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 62c5a01 commit e807c40

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/misc/lis3lv02d/lis3lv02d.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ int lis3lv02d_init_dt(struct lis3lv02d *lis3)
10381038
pdata->wakeup_flags |= LIS3_WAKEUP_Z_LO;
10391039
if (of_property_read_bool(np, "st,wakeup-z-hi"))
10401040
pdata->wakeup_flags |= LIS3_WAKEUP_Z_HI;
1041-
if (of_get_property(np, "st,wakeup-threshold", &val))
1041+
if (!of_property_read_u32(np, "st,wakeup-threshold", &val))
10421042
pdata->wakeup_thresh = val;
10431043

10441044
if (of_property_read_bool(np, "st,wakeup2-x-lo"))
@@ -1053,7 +1053,7 @@ int lis3lv02d_init_dt(struct lis3lv02d *lis3)
10531053
pdata->wakeup_flags2 |= LIS3_WAKEUP_Z_LO;
10541054
if (of_property_read_bool(np, "st,wakeup2-z-hi"))
10551055
pdata->wakeup_flags2 |= LIS3_WAKEUP_Z_HI;
1056-
if (of_get_property(np, "st,wakeup2-threshold", &val))
1056+
if (!of_property_read_u32(np, "st,wakeup2-threshold", &val))
10571057
pdata->wakeup_thresh2 = val;
10581058

10591059
if (!of_property_read_u32(np, "st,highpass-cutoff-hz", &val)) {

0 commit comments

Comments
 (0)