linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hwmon: (tmp421) make const array 'names' static
@ 2018-10-09 12:11 Colin King
  2018-10-10  0:36 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2018-10-09 12:11 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck, linux-hwmon; +Cc: kernel-janitors, linux-kernel

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(-)

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;
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] hwmon: (tmp421) make const array 'names' static
  2018-10-09 12:11 [PATCH] hwmon: (tmp421) make const array 'names' static Colin King
@ 2018-10-10  0:36 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2018-10-10  0:36 UTC (permalink / raw)
  To: Colin King; +Cc: Jean Delvare, linux-hwmon, kernel-janitors, linux-kernel

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;
>  

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-10  0:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-09 12:11 [PATCH] hwmon: (tmp421) make const array 'names' static Colin King
2018-10-10  0:36 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).