[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1487129788.6214.41.camel@perches.com>
Date: Tue, 14 Feb 2017 19:36:28 -0800
From: Joe Perches <joe@...ches.com>
To: "Tobin C. Harding" <me@...in.cc>,
Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>,
noralf@...nnes.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/3] staging: fbtft: Replace magic number with
constant
On Wed, 2017-02-15 at 14:27 +1100, Tobin C. Harding wrote:
> Current call to strncmp() uses a magic number. There is a compile
> time constant defined for this buffer, included and used already at
> other sites in the file.
>
> Remove magic number. Replace with pre-existing compile time constant.
OK thanks, as well:
> diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c
[]
> @@ -1489,7 +1489,7 @@ static int __init fbtft_device_init(void)
> }
>
> for (i = 0; i < ARRAY_SIZE(displays); i++) {
> - if (strncmp(name, displays[i].name, 32) == 0) {
> + if (strncmp(name, displays[i].name, SPI_NAME_SIZE) == 0) {
Maybe change this to:
if (strncmp(name, displays[i].name, SPI_NAME_SIZE) != 0)
continue;
and reduce the indentation of the rest of the block.
Powered by blists - more mailing lists