From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A5B6C47082 for ; Mon, 31 May 2021 08:41:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EE7BA6023E for ; Mon, 31 May 2021 08:41:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231208AbhEaInI (ORCPT ); Mon, 31 May 2021 04:43:08 -0400 Received: from mail.skyhub.de ([5.9.137.197]:40282 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231263AbhEaImU (ORCPT ); Mon, 31 May 2021 04:42:20 -0400 Received: from zn.tnic (p200300ec2f080f006c0d0ceb240e6208.dip0.t-ipconnect.de [IPv6:2003:ec:2f08:f00:6c0d:ceb:240e:6208]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id AC8BE1EC0489; Mon, 31 May 2021 10:40:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1622450439; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=KoQphbyuo1/nKVZ7OXCY8vZ8trKuzaVJ0+007WK774E=; b=N9fVxbFksZfdYLZfuKCOZ50uvndPclGsmM/ftiqS3Pv0QBQ2s/gsqNinQmlM+CvGSJhkSJ BKS/CN02XnSAgK8X0qsUXx4mH14Tdx6sCoEJ3cJT/3pi3Z/Yv8Dr1o1iCkPiXgbN0KM2qc wkzM9PAz0CgMFJ6kwewLKtceWIOHloA= Date: Mon, 31 May 2021 10:40:31 +0200 From: Borislav Petkov To: Zhen Lei Cc: Johannes Thumshirn , Mauro Carvalho Chehab , Tony Luck , James Morse , Robert Richter , Doug Thompson , Dave Jiang , Andrew Morton , linux-edac , linux-kernel Subject: Re: [PATCH 1/1] EDAC, mpc85xx: Fix error return code in two functions Message-ID: References: <20210528032637.9231-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210528032637.9231-1-thunder.leizhen@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org On Fri, May 28, 2021 at 11:26:37AM +0800, Zhen Lei wrote: > Fix to return -EFAULT from the error handling case instead of 0, as done > elsewhere in its function. > > Fixes: a9a753d53204 ("drivers-edac: add freescale mpc85xx driver") > Reported-by: Hulk Robot > Signed-off-by: Zhen Lei > --- > drivers/edac/mpc85xx_edac.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c > index 67f7bc3fe5b3..b2eaa62c9412 100644 > --- a/drivers/edac/mpc85xx_edac.c > +++ b/drivers/edac/mpc85xx_edac.c > @@ -248,6 +248,7 @@ static int mpc85xx_pci_err_probe(struct platform_device *op) > > if (edac_pci_add_device(pci, pdata->edac_idx) > 0) { > edac_dbg(3, "failed edac_pci_add_device()\n"); > + res = -EFAULT; > goto err; > } > > @@ -552,6 +553,7 @@ static int mpc85xx_l2_err_probe(struct platform_device *op) > > if (edac_device_add_device(edac_dev) > 0) { > edac_dbg(3, "failed edac_device_add_device()\n"); > + res = -EFAULT; > goto err; > } > > -- EFAULT means #define EFAULT 14 /* Bad address */ Does it make sense to you when the probe function returns a "bad address" upon failure to add a device? hint 1: you might wanna audit how the other drivers are calling this for better ideas. hint 2: while doing hint 1, you might find some more broken cases which you could fix too. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette