瀏覽代碼

hwmon: (tmp421) make const array 'names' static

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>
Colin Ian King 6 年之前
父節點
當前提交
8b9bf554dd
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      drivers/hwmon/tmp421.c

+ 4 - 2
drivers/hwmon/tmp421.c

@@ -226,8 +226,10 @@ static int tmp421_detect(struct i2c_client *client,
 {
 {
 	enum chips kind;
 	enum chips kind;
 	struct i2c_adapter *adapter = client->adapter;
 	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;
 	int addr = client->addr;
 	u8 reg;
 	u8 reg;