]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.10.7/iio-sw-device-fix-config-group-initialization.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.10.7 / iio-sw-device-fix-config-group-initialization.patch
CommitLineData
309a988b
GKH
1From c42f8218610aa09d7d3795e5810387673c1f84b6 Mon Sep 17 00:00:00 2001
2From: Lars-Peter Clausen <lars@metafoo.de>
3Date: Thu, 9 Mar 2017 17:20:04 +0100
4Subject: iio: sw-device: Fix config group initialization
5
6From: Lars-Peter Clausen <lars@metafoo.de>
7
8commit c42f8218610aa09d7d3795e5810387673c1f84b6 upstream.
9
10Use the IS_ENABLED() helper macro to ensure that the configfs group is
11initialized either when configfs is built-in or when configfs is built as a
12module. Otherwise software device creation will result in undefined
13behaviour when configfs is built as a module since the configfs group for
14the device not properly initialized.
15
16Similar to commit b2f0c09664b7 ("iio: sw-trigger: Fix config group
17initialization").
18
19Fixes: 0f3a8c3f34f7 ("iio: Add support for creating IIO devices via configfs")
20Reported-by: Miguel Robles <miguel.robles@farole.net>
21Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
22Acked-by: Daniel Baluta <daniel.baluta@gmail.com>
23Signed-off-by: Jonathan Cameron <jic23@kernel.org>
24Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25
26---
27 include/linux/iio/sw_device.h | 2 +-
28 1 file changed, 1 insertion(+), 1 deletion(-)
29
30--- a/include/linux/iio/sw_device.h
31+++ b/include/linux/iio/sw_device.h
32@@ -62,7 +62,7 @@ void iio_swd_group_init_type_name(struct
33 const char *name,
34 struct config_item_type *type)
35 {
36-#ifdef CONFIG_CONFIGFS_FS
37+#if IS_ENABLED(CONFIG_CONFIGFS_FS)
38 config_group_init_type_name(&d->group, name, type);
39 #endif
40 }