Commit b9f55084 authored by Jani Nikula's avatar Jani Nikula Committed by Guenter Roeck
Browse files

hwmon: put HWMON_CHANNEL_INFO() initializers in rodata



HWMON_CHANNEL_INFO() is supposed to be used as initializer for arrays of
const struct hwmon_channel_info *. However, without explicit const,
HWMON_CHANNEL_INFO() creates mutable compound literals, and the const
pointers point at the mutable data. Add const to place the data in
rodata.

Cc: Jean Delvare <jdelvare@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://lore.kernel.org/r/20240117114405.1506775-1-jani.nikula@intel.com


Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 841c3516
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -426,9 +426,9 @@ struct hwmon_channel_info {
};

#define HWMON_CHANNEL_INFO(stype, ...)		\
	(&(struct hwmon_channel_info) {	\
	(&(const struct hwmon_channel_info) {	\
		.type = hwmon_##stype,		\
		.config = (u32 []) {	\
		.config = (const u32 []) {	\
			__VA_ARGS__, 0		\
		}				\
	})