]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: magnetometer: fix if () scoped_guard() formatting
authorStephen Rothwell <sfr@canb.auug.org.au>
Fri, 8 Nov 2024 15:41:27 +0000 (16:41 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 11 Nov 2024 10:49:47 +0000 (11:49 +0100)
Add mising braces after an if condition that contains scoped_guard().

This style is both preferred and necessary here, to fix warning after
scoped_guard() change in commit fcc22ac5baf0 ("cleanup: Adjust
scoped_guard() macros to avoid potential warning") to have if-else inside
of the macro. Current (no braces) use in af8133j_set_scale() yields
the following warnings:
af8133j.c:315:12: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
af8133j.c:316:3: warning: add explicit braces to avoid dangling else [-Wdangling-else]

Fixes: fcc22ac5baf0 ("cleanup: Adjust scoped_guard() macros to avoid potential warning")
Closes: https://lore.kernel.org/oe-kbuild-all/202409270848.tTpyEAR7-lkp@intel.com/
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20241108154258.21411-1-przemyslaw.kitszel@intel.com
drivers/iio/magnetometer/af8133j.c

index d81d89af6283b70162ebcc62bb0f332c7f1a8c92..acd291f3e7924c8cd8447bf884453256d74362c2 100644 (file)
@@ -312,10 +312,11 @@ static int af8133j_set_scale(struct af8133j_data *data,
         * When suspended, just store the new range to data->range to be
         * applied later during power up.
         */
-       if (!pm_runtime_status_suspended(dev))
+       if (!pm_runtime_status_suspended(dev)) {
                scoped_guard(mutex, &data->mutex)
                        ret = regmap_write(data->regmap,
                                           AF8133J_REG_RANGE, range);
+       }
 
        pm_runtime_enable(dev);