Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp725509ybl; Tue, 13 Aug 2019 01:27:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQH4Alk/dSdEKGx0INRnoojhT5eqjNWIlbG950Iy4tiqJX6cm84Vn2i3niQheWysA77B/H X-Received: by 2002:a17:902:7581:: with SMTP id j1mr10129551pll.289.1565684830509; Tue, 13 Aug 2019 01:27:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565684830; cv=none; d=google.com; s=arc-20160816; b=rVZdt6AEJQ4VZqFzJpvEf9oteAi6SqiZ+EAXuX8zdC0VRUwT5Q5r9+9YYo5EOnuPH+ ZJMy/+CYSjOaCl1C2rPkzly9N/JSvkgreSiTNpaXJUKMAUqPly8wIKRETbo76pPAmEkr DgAh4nSXTrqxEx7G6uRzE0WjHP32VhKCuxK4lV2NEryogV3i5XwG2zB5P+zbAM5rDEqb mbN2X2OlQrCaH2T1X1/RjjLZO2nVpnuTS0nvDavTR3qmzvK8VJ6HBwXkW+3JHV8Z3Y67 taX+EZJ7yypyJBDA1xqclGazHGK7mfKNuq3gTgs6qt1Lrfn28WiKDMpUZc/ztQo6RXTj 0EOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=kMHQqLdJXGlWXDypDhXFGkicG1MjfC0RcqBNXKxeJyw=; b=oOgU4pRTjNiV6eOnWsb4NYDEUEz97ykmMOYcrCrnfVGNEycqU09z8MmWP2drF4g3I/ SIYDlOLipIwQCqRVjkWQGoEjrlEKKI8t1LA1nAlXF+kRsRt1OMhcDLNqGYWEXrG/Nb9T RgpIOLrXhnMpABLTJNqfGTiDdkZ0BI5TwmMUc1pj/+CFZtbXPmh6286qQU9jS8IA+AUQ uIpW/WmI21kB22Mwd2TnKJtj7fB4NxnkwtCYT0pTSHOITt2LzIDdH2J/kVg5dYWVzUzj 4vW2CQ9mvJ24vrJJ1mR2Xi0SXdddZrErG0l+8IcMa4h4fHMiTTgqcpLltWGCA6dVr+gz aOXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b="LoW/iMar"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g7si2558764pfk.224.2019.08.13.01.26.54; Tue, 13 Aug 2019 01:27:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b="LoW/iMar"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728122AbfHMI0I (ORCPT + 99 others); Tue, 13 Aug 2019 04:26:08 -0400 Received: from mail.skyhub.de ([5.9.137.197]:52086 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727793AbfHMI0H (ORCPT ); Tue, 13 Aug 2019 04:26:07 -0400 Received: from zn.tnic (p200300EC2F0D240075AA4C13F769B7E7.dip0.t-ipconnect.de [IPv6:2003:ec:2f0d:2400:75aa:4c13:f769:b7e7]) (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 4C8A01EC04CD; Tue, 13 Aug 2019 10:26:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1565684766; 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=kMHQqLdJXGlWXDypDhXFGkicG1MjfC0RcqBNXKxeJyw=; b=LoW/iMar3Wlq4ekq1oG1U/IP9qMzb9DTVQdgQ8q16OBILecjuGaswbzJnRbbCViXEKCbNY 1VbZUGF2/ejKyz2T7heBR6H/71Rgc6IbIBo5tEbP6edOIuMXNB6howRTl8i/guemt10w37 5ye2vqyukGIi3zUjSDv1vtEUdhKtlcg= Date: Tue, 13 Aug 2019 10:26:55 +0200 From: Borislav Petkov To: Robert Richter Cc: James Morse , Mauro Carvalho Chehab , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2 05/24] EDAC, mc: Fix and improve sysfs init functions Message-ID: <20190813082655.GD16770@zn.tnic> References: <20190624150758.6695-1-rrichter@marvell.com> <20190624150758.6695-6-rrichter@marvell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190624150758.6695-6-rrichter@marvell.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 24, 2019 at 03:09:02PM +0000, Robert Richter wrote: > Remove gotos as they just create overhead. Overhead? > Also, fix debug message for > the case edac_create_dimm_object() is failing. > > Signed-off-by: Robert Richter > --- > drivers/edac/edac_mc_sysfs.c | 25 +++++++++---------------- > 1 file changed, 9 insertions(+), 16 deletions(-) > > diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c > index 7c01e1cc030c..29dd9719f82f 100644 > --- a/drivers/edac/edac_mc_sysfs.c > +++ b/drivers/edac/edac_mc_sysfs.c > @@ -655,8 +655,9 @@ static int edac_create_dimm_object(struct mem_ctl_info *mci, > err = device_add(&dimm->dev); > if (err) > put_device(&dimm->dev); > - > - edac_dbg(0, "created rank/dimm device %s\n", dev_name(&dimm->dev)); > + else > + edac_dbg(0, "created rank/dimm device %s\n", > + dev_name(&dimm->dev)); Please add a message to the error case too. > return err; > } > @@ -938,7 +939,7 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci, > if (err < 0) { > edac_dbg(1, "failure: create device %s\n", dev_name(&mci->dev)); > put_device(&mci->dev); > - goto out; > + return err; > } > > /* > @@ -987,7 +988,6 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci, > } > device_unregister(&mci->dev); > > -out: > return err; > } > > @@ -1044,10 +1044,8 @@ int __init edac_mc_sysfs_init(void) > int err; > > mci_pdev = kzalloc(sizeof(*mci_pdev), GFP_KERNEL); > - if (!mci_pdev) { > - err = -ENOMEM; > - goto out; > - } > + if (!mci_pdev) > + return -ENOMEM; > > mci_pdev->bus = edac_get_sysfs_subsys(); > mci_pdev->type = &mc_attr_type; > @@ -1056,15 +1054,10 @@ int __init edac_mc_sysfs_init(void) > > err = device_add(mci_pdev); > if (err < 0) > - goto out_put_device; > - > - edac_dbg(0, "device %s created\n", dev_name(mci_pdev)); > - > - return 0; > + put_device(mci_pdev); > + else > + edac_dbg(0, "device %s created\n", dev_name(mci_pdev)); Ditto. Thx. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.