]> www.infradead.org Git - linux.git/commitdiff
misc: lis3lv02d: Fix incorrect of_get_property() usage
authorRob Herring (Arm) <robh@kernel.org>
Wed, 28 Aug 2024 13:18:51 +0000 (08:18 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 3 Sep 2024 10:33:42 +0000 (12:33 +0200)
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) <robh@kernel.org>
Link: https://lore.kernel.org/r/20240828131851.3631855-1-robh@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/lis3lv02d/lis3lv02d.c

index 49868a45c0ad1a1f3bf7c821e1e52c1a7a597536..1fc635a27568190e23d4ee28758e8e600216fd24 100644 (file)
@@ -1038,7 +1038,7 @@ int lis3lv02d_init_dt(struct lis3lv02d *lis3)
                pdata->wakeup_flags |= LIS3_WAKEUP_Z_LO;
        if (of_property_read_bool(np, "st,wakeup-z-hi"))
                pdata->wakeup_flags |= LIS3_WAKEUP_Z_HI;
-       if (of_get_property(np, "st,wakeup-threshold", &val))
+       if (!of_property_read_u32(np, "st,wakeup-threshold", &val))
                pdata->wakeup_thresh = val;
 
        if (of_property_read_bool(np, "st,wakeup2-x-lo"))
@@ -1053,7 +1053,7 @@ int lis3lv02d_init_dt(struct lis3lv02d *lis3)
                pdata->wakeup_flags2 |= LIS3_WAKEUP_Z_LO;
        if (of_property_read_bool(np, "st,wakeup2-z-hi"))
                pdata->wakeup_flags2 |= LIS3_WAKEUP_Z_HI;
-       if (of_get_property(np, "st,wakeup2-threshold", &val))
+       if (!of_property_read_u32(np, "st,wakeup2-threshold", &val))
                pdata->wakeup_thresh2 = val;
 
        if (!of_property_read_u32(np, "st,highpass-cutoff-hz", &val)) {