diff mbox series

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

Message ID 20181009121157.21656-1-colin.king@canonical.com (mailing list archive)
State Accepted
Headers show
Series hwmon: (tmp421) make const array 'names' static | expand

Commit Message

Colin King Oct. 9, 2018, 12:11 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

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>
---
 drivers/hwmon/tmp421.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Guenter Roeck Oct. 10, 2018, 12:36 a.m. UTC | #1
On Tue, Oct 09, 2018 at 01:11:57PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> 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>

Applied to hwmon-next.

Thanks,
Guenter

> ---
>  drivers/hwmon/tmp421.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c
> index e36399213324..8844c9565d2a 100644
> --- a/drivers/hwmon/tmp421.c
> +++ b/drivers/hwmon/tmp421.c
> @@ -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;
>
diff mbox series

Patch

diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c
index e36399213324..8844c9565d2a 100644
--- a/drivers/hwmon/tmp421.c
+++ b/drivers/hwmon/tmp421.c
@@ -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;