Re: [PATCH] Staging: most: fix coding style issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux