mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thor Thayer <thor.thayer@linux.intel.com>
To: Borislav Petkov <bp@alien8.de>
Cc: mchehab@kernel.org, linux-edac@vger.kernel.org,
	linux-kernel@vger.kernel.org, thor.thayer@linux.intel.com.com
Subject: Re: [PATCH] EDAC, altera: Fix peripheral warnings for Cyclone5
Date: Tue, 4 Apr 2017 09:28:08 -0500	[thread overview]
Message-ID: <ce9c5079-7eba-af41-f699-e2b28e57e403@linux.intel.com> (raw)
In-Reply-To: <20170404095910.jhstk52dgy6brnhb@pd.tnic>

Hi Boris,

On 04/04/2017 04:59 AM, Borislav Petkov wrote:
> On Mon, Apr 03, 2017 at 02:01:06PM -0500, thor.thayer@linux.intel.com wrote:
>> From: Thor Thayer <thor.thayer@linux.intel.com>
>>
>> The peripherals EDACs only exist on the Arria10 SoCFPGA. The Cyclone5
>> initialization has EDAC warnings when the peripherals aren't found
>> in the device tree. Fix by checking for Arria10 in the init functions.
>>
>> Signed-off-by: Thor Thayer <thor.thayer@linux.intel.com>
>> ---
>>  drivers/edac/altera_edac.c | 29 +++++++++++++++++++++++++----
>>  1 file changed, 25 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
>> index 6421cc3..98e83f5 100644
>> --- a/drivers/edac/altera_edac.c
>> +++ b/drivers/edac/altera_edac.c
>> @@ -1024,13 +1024,30 @@ static int __maybe_unused altr_init_memory_port(void __iomem *ioaddr, int port)
>>  	return ret;
>>  }
>>
>> +static int invalid_model(void)
>> +{
>> +	struct device_node *np = of_find_node_by_path("/");
>
> That needs to have its return value checked, of course.
>
Actually, some of the of_ functions have validity checking in them.  In 
this case, of_get_property() calls of_find_property() which returns NULL 
if np is 0 which is propagated back up to model so this code should be safe.

In the case of the of_node_put() below, the node is also checked for 
non-NULL so I should be OK there.

>> +	const char *model = of_get_property(np, "model", NULL);
>> +
>> +	of_node_put(np);
>> +	if (!model || strncmp(model, "Altera SOCFPGA Arria 10", 23) != 0)
>
> No need for the "!= 0"
>
OK. Thanks.

>> +		return -ENODEV;
>> +
>> +	return 0;
>> +}
>
> That function name "invalid_model" sounds like a boolean: is the model
> invalid. So you can simply return bools and not -ENODEV as the context
> you're using it is boolean.
>
Good point, thanks. I'll fix and re-submit.

Thanks for reviewing!

      reply	other threads:[~2017-04-04 14:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-03 19:01 thor.thayer
2017-04-04  9:59 ` Borislav Petkov
2017-04-04 14:28   ` Thor Thayer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ce9c5079-7eba-af41-f699-e2b28e57e403@linux.intel.com \
    --to=thor.thayer@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=thor.thayer@linux.intel.com.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome