hwmon: (tmp421) make const array 'names' static
authorColin Ian King <colin.king@canonical.com>
Tue, 9 Oct 2018 12:11:57 +0000 (13:11 +0100)
committerGuenter Roeck <linux@roeck-us.net>
Thu, 11 Oct 2018 03:37:13 +0000 (20:37 -0700)
The const array 'names' can be made static, saves populating it on
the stack and will make it read-only.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/tmp421.c

index e363992..8844c95 100644 (file)
@@ -226,8 +226,10 @@ static int tmp421_detect(struct i2c_client *client,
 {
        enum chips kind;
        struct i2c_adapter *adapter = client->adapter;
-       const char * const names[] = { "TMP421", "TMP422", "TMP423",
-                                      "TMP441", "TMP442" };
+       static const char * const names[] = {
+               "TMP421", "TMP422", "TMP423",
+               "TMP441", "TMP442"
+       };
        int addr = client->addr;
        u8 reg;