[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dbe411be6aa32a32aafc5a5b77f08e8507b45da3.camel@perches.com>
Date: Sat, 29 Jun 2019 16:58:46 -0700
From: Joe Perches <joe@...ches.com>
To: Gabriel Beauchamp <beauchampgabriel@...il.com>,
gregkh@...uxfoundation.org, christian.gromm@...rochip.com,
colin.king@...onical.com, gustavo@...eddedor.com
Cc: devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Staging: most: fix coding style issues
On Sat, 2019-06-29 at 16:44 -0700, Gabriel Beauchamp wrote:
> This is a patch for the core.[ch] files that fixes up warnings
> found with the checkpatch.pl tool.
[]
> diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
[]
> @@ -303,7 +303,8 @@ static ssize_t set_datatype_show(struct device *dev,
>
> for (i = 0; i < ARRAY_SIZE(ch_data_type); i++) {
> if (c->cfg.data_type & ch_data_type[i].most_ch_data_type)
> - return snprintf(buf, PAGE_SIZE, "%s", ch_data_type[i].name);
> + return snprintf(buf, PAGE_SIZE,
> + "%s", ch_data_type[i].name);
> }
> return snprintf(buf, PAGE_SIZE, "unconfigured\n");
> }
Assuming the newline difference is unintentional,
(if not change "unconfigured" to "unconfigured\n")
How about using a single sprintf and reducing object code size too?
char *type = "unconfigured";
for (...)
if (c-> etc...) {
type = ch_data_type[i].name;
break;
}
}
return snprintf(buf, PAGE_SIZE, "%s", type);
Powered by blists - more mailing lists