lkml.org 
[lkml]   [2019]   [Jun]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] Staging: most: fix coding style issues
From
Date
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);



\
 
 \ /
  Last update: 2019-06-30 02:01    [W:0.124 / U:1.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site