Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753709AbdDDJ7l (ORCPT ); Tue, 4 Apr 2017 05:59:41 -0400 Received: from mail.skyhub.de ([5.9.137.197]:50192 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753276AbdDDJ7U (ORCPT ); Tue, 4 Apr 2017 05:59:20 -0400 Date: Tue, 4 Apr 2017 11:59:10 +0200 From: Borislav Petkov To: thor.thayer@linux.intel.com 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 Message-ID: <20170404095910.jhstk52dgy6brnhb@pd.tnic> References: <1491246066-22334-1-git-send-email-thor.thayer@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1491246066-22334-1-git-send-email-thor.thayer@linux.intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1486 Lines: 47 On Mon, Apr 03, 2017 at 02:01:06PM -0500, thor.thayer@linux.intel.com wrote: > From: Thor Thayer > > 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 > --- > 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. > + 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" > + 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. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.