Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp228709imm; Thu, 14 Jun 2018 19:00:56 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKVVfOtcJRlD9ZcEOH5SkoOc2YTbKdFQRWGLxArZ2mkudxjGztgUiHLSHj7pfy4huE5Dqex X-Received: by 2002:a17:902:6b47:: with SMTP id g7-v6mr5737655plt.251.1529028056322; Thu, 14 Jun 2018 19:00:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529028056; cv=none; d=google.com; s=arc-20160816; b=fUYQBgHETIcSd4s+3tKyXk06s3rgf5k+WVq/9G/5QBhWCV2E/2hBOycI1+dLNntig6 xoMWFNXckNEt53pArqmQqouOb1AojJXSTAy6jyp1jvhnlyBAt69dSOkohnTAe+IW9xdI apxfr28LrZW51zedWBubgj/IRJpPyBPf0uiDRKX01eIvJl22d+9clmoasAy/289n1r8O pUg9G1bs4nuItyqAyP3yrFzZfi25+IXcQDnA5jO0Ps8UKWqhkLvwiYFYu2+SXxVsEXVL Ip7yCxYEte9+JWhErKsnlUfy6qJmnd1N6kw8zPc+QVtqfL/1DbaUr1XlbniLMHZP6bIa HTbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date :arc-authentication-results; bh=/3XCiMOHkTVDIL0ZuTnfv2mIrWQREESsqAy74jqrQ68=; b=KnChs3OjCMferXBao+d6fLk5blRBjd14/cxbkrMX5+7enjnr2dLcthdRCCCVsCKFVk 1xC5P1z3fW7Wc5x96lp/NZ8LAR/QpAI89eVwy3Px2eL0dPrUAkUJ+CbOpYifDvUQAUM3 PH3kl54teUUVeSWKaaYNEahvT65GwhpQvrYKv9+dSpZGqh9ZeQpNDkc8up2Alry+XBLD coj5mcziwDavFzYIFPOv8qernh79VbuUVie0/3ozumPtCYKKqE44AriDaMgOn4nl4cSm fgcZfZfPmLGsV5XCjkP9J6zz5ZezkGt0ZVb4cOkNs2Wce4IVlUwSig/4Gg6rMLhcuk4L 2u/w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g26-v6si6647466pfe.4.2018.06.14.19.00.42; Thu, 14 Jun 2018 19:00:56 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965362AbeFOCAU (ORCPT + 99 others); Thu, 14 Jun 2018 22:00:20 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:52038 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965063AbeFOCAT (ORCPT ); Thu, 14 Jun 2018 22:00:19 -0400 Received: from localhost (74-93-104-98-Washington.hfc.comcastbusiness.net [74.93.104.98]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 7FA9B10080D12; Thu, 14 Jun 2018 19:00:18 -0700 (PDT) Date: Thu, 14 Jun 2018 19:00:18 -0700 (PDT) Message-Id: <20180614.190018.1696051015226293779.davem@davemloft.net> To: jiazhouyang09@gmail.com Cc: santosh@chelsio.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: cxgb3: add error handling for sysfs_create_group From: David Miller In-Reply-To: <1528984571-53320-1-git-send-email-jiazhouyang09@gmail.com> References: <1528984571-53320-1-git-send-email-jiazhouyang09@gmail.com> X-Mailer: Mew version 6.7 on Emacs 25.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Thu, 14 Jun 2018 19:00:18 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhouyang Jia Date: Thu, 14 Jun 2018 21:56:11 +0800 > diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c > index 2edfdbd..73d6aa9 100644 > --- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c > +++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c > @@ -3362,6 +3362,10 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) > > err = sysfs_create_group(&adapter->port[0]->dev.kobj, > &cxgb3_attr_group); > + if (err) { > + dev_err(&pdev->dev, "cannot create sysfs group\n"); > + goto out_free_dev; > + } You have to do more than this to cleanup. For example, you have to change the LED state back, as it has just been set to indicate that the interface is operational.