Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1977607imm; Thu, 14 Jun 2018 06:58:12 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLbIkvVTm2fRRgUPwzt1kbsQZgdnlKJKoVO2lVfAdoxVyyjGeUXHSKW2fV7dZXoISHygVJB X-Received: by 2002:a17:902:43a4:: with SMTP id j33-v6mr3205682pld.118.1528984692003; Thu, 14 Jun 2018 06:58:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528984691; cv=none; d=google.com; s=arc-20160816; b=NEbgB/Z1i+GevGn9BAgL0HultNYcEuZ5IzZmbgTpt0DJaZHrmbeqKIy7F+VeN7tWat bAa5f9mSv3G3rP+b6iq7TuALtDqQ91B+UXFg9ldoFP9XjGAOOwwg0hcMcvoI91PwprDI TNoKAcZVoEZPU1kFrbIqfKDtVgFtucfbAcdDCj0pzq6yQHg29MpdxmReE4GSx4ybvRer AbxwGgcGpJZkkaALcjolviE6aQZJNzndjibEcOF8bnek63DKuaTr8gzTUWiq99uVusLS 7eTpiG5NAJaflTVDkUpIs6+4qRLDBDYEQmmkiv/sRllYft8Mb0M5oIUVXf4TdcQRhCJg fBXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:message-id:date:subject:cc:from :dkim-signature:arc-authentication-results; bh=MDHFqi6TfCuUOuNr4wb4pBhZm0cWifImhuUe9blRcbU=; b=plThL6X5b16lHBsyQfVlfOBCVVz73eSxqV1AXZ65jzIrCpJaOy9L7zKz9+PmNraapi 9bzzgCn3z9LMuPiyhcjX658qiSVAiG1sv+KaXHWsIcmWQuNPqy5SK/V4zCZIsVdODenM GkpT+ysHtf8eAvklDOl6T5C7+NKKtp2UoLojWbUyNqZoGeAtbgdVUy8i4xLwMcfZlL7H bhTwluLJVn8RF+Rj7c5N1VxEht49LrxIqWZtVCzTd1s1sigBrg+HPN8vjq0ZdbVjq3j7 /EesQx43q9UIn5VGueywA1UNH7bnOdJvqiUJdwvIyjw3ARL0JRGBc/SIcTz3RjB+D/Me QkWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=n1MjEZG6; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k2-v6si4433396pgc.321.2018.06.14.06.57.57; Thu, 14 Jun 2018 06:58:11 -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=fail header.i=@gmail.com header.s=20161025 header.b=n1MjEZG6; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935912AbeFNN4S (ORCPT + 99 others); Thu, 14 Jun 2018 09:56:18 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:37123 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755064AbeFNN4Q (ORCPT ); Thu, 14 Jun 2018 09:56:16 -0400 Received: by mail-pl0-f68.google.com with SMTP id 31-v6so3602751plc.4; Thu, 14 Jun 2018 06:56:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=MDHFqi6TfCuUOuNr4wb4pBhZm0cWifImhuUe9blRcbU=; b=n1MjEZG6Ly4SIqXxReltjNY2ocjJe19aoIVQPkJcBWgIw6fIM1iG1C11ySOHK7Mtmc OM8+FtAMp+hzWdDHk/QfGbh7s0SdlCkhYAr31RzkW80sLEyGOFdI1dBvqDodfLEIceDL kwC7JWcdK3U6MtD/XyT2TrMI9TBp2WB7Q+qqhDazOzR+a+mEprlMFvAVJ71FpulW0Ase 6pVnPPLaBGquDGzGMlociBX7dRV9he6ojIIewSrUULTLbaOcthuw3+IZZF/jzIZBmrPC j8VGRKkWnLkqMYgmU8Rn4jeHXvt3aTQM4fi7zQq6/fazOxk1HWGIh4mcuVDzuMtwK8So 0s5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=MDHFqi6TfCuUOuNr4wb4pBhZm0cWifImhuUe9blRcbU=; b=Wup+FuzgYQHUFf3QcJ0lkY06xrbqd5NJp75qmBRsaouhxi81kOqQEjcDV3hq4MFp42 HgLRUr6kZlYMxP/Vi9IUQtohMaKt5PozshSnOns9zEeeD2MmeGpqySUCN45wXPkH/LQP utdNwXJtv3Y4bD4epA6SH46zWuqx083U0A9n0O3f4MtQ4a1KFw01V2t9sjH2TJ/t/cmO VVEjT7Db5FHTbNxZl7BKRGZqmSXkxTIFXBxC9hWA58hfYMwtktN4OSEFtyk0ibH3XIzn f/o3Td9ajgl2KaM69O6IYCfqW3aPopEjNHbcTIRo+M1b9SCFa941/0JTIklZPZhsjSRY Jz6w== X-Gm-Message-State: APt69E1o6J6Fx65rCEJ5QapfYh100x2FXkZOe0yE9QxVLF7Qdb9vEEM4 QoEWOtvW03PGYcLPPIkLhhL9Vxgxi/I= X-Received: by 2002:a17:902:7442:: with SMTP id e2-v6mr3247200plt.28.1528984576201; Thu, 14 Jun 2018 06:56:16 -0700 (PDT) Received: from localhost ([103.88.46.82]) by smtp.gmail.com with ESMTPSA id k129-v6sm7337636pga.94.2018.06.14.06.56.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jun 2018 06:56:15 -0700 (PDT) From: Zhouyang Jia Cc: Zhouyang Jia , Santosh Raspatur , "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: cxgb3: add error handling for sysfs_create_group Date: Thu, 14 Jun 2018 21:56:11 +0800 Message-Id: <1528984571-53320-1-git-send-email-jiazhouyang09@gmail.com> X-Mailer: git-send-email 2.7.4 To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When sysfs_create_group fails, the lack of error-handling code may cause unexpected results. This patch adds error-handling code after calling sysfs_create_group. Signed-off-by: Zhouyang Jia --- drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | 4 ++++ 1 file changed, 4 insertions(+) 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; + } print_port_info(adapter, ai); return 0; -- 2.7.4