From patchwork Fri Jun 21 02:26:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 2759851 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AF74E9F472 for ; Fri, 21 Jun 2013 02:26:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A588B20199 for ; Fri, 21 Jun 2013 02:26:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0C92720188 for ; Fri, 21 Jun 2013 02:26:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757940Ab3FUC0N (ORCPT ); Thu, 20 Jun 2013 22:26:13 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:41551 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757600Ab3FUC0M (ORCPT ); Thu, 20 Jun 2013 22:26:12 -0400 Received: by mail-wi0-f177.google.com with SMTP id ey16so156334wid.10 for ; Thu, 20 Jun 2013 19:26:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=EE6yjB84VrJqlXhbpTB1/7ej7O1i0PfhFa2F3hUS5sk=; b=DdvgFb1Yv/lwQasSLHk/HO/02ttTJQrhR420TjilK8mMW1S3aFfSqg3mmSTU92ecHT yg1Bbq2ueC9JdYdakqcKMeXIM7W1hR5bEiLMY0dOaOjwIJdrb90KlPFOgHz8b7CL/uLo pia75qsMNfXZ8ivLx7f5TWaf9QSKxBrbR9Co1O5uQwTBwtjnpXo9R6HuQt4DCfXC9Wpu ngrpSOSxQBpbpIA3CyC/QXyjTEh61UK02x5vqkXe5W1tiYQhz7h37cjEF+/yToHs600c tJudcPkaiJrnavYsGhqcPZlGx3Y3h6WfAZhK8vX+ZXIouhDPAXRWma/MXnTezrTVWLhx RkqA== MIME-Version: 1.0 X-Received: by 10.180.91.107 with SMTP id cd11mr1367121wib.12.1371781570857; Thu, 20 Jun 2013 19:26:10 -0700 (PDT) Received: by 10.194.240.167 with HTTP; Thu, 20 Jun 2013 19:26:10 -0700 (PDT) Date: Fri, 21 Jun 2013 10:26:10 +0800 Message-ID: Subject: [PATCH] IB/core: Fix error return code in add_port() From: Wei Yongjun To: roland@kernel.org, sean.hefty@intel.com, hal.rosenstock@gmail.com Cc: yongjun_wei@trendmicro.com.cn, linux-rdma@vger.kernel.org Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wei Yongjun Fix to return -ENOMEM in the alloc_group_attrs() error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun --- drivers/infiniband/core/sysfs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index 246fdc1..d9b78c4 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c @@ -545,8 +545,10 @@ static int add_port(struct ib_device *device, int port_num, p->gid_group.name = "gids"; p->gid_group.attrs = alloc_group_attrs(show_port_gid, attr.gid_tbl_len); - if (!p->gid_group.attrs) + if (!p->gid_group.attrs) { + ret = -ENOMEM; goto err_remove_pma; + } ret = sysfs_create_group(&p->kobj, &p->gid_group); if (ret) @@ -555,8 +557,10 @@ static int add_port(struct ib_device *device, int port_num, p->pkey_group.name = "pkeys"; p->pkey_group.attrs = alloc_group_attrs(show_port_pkey, attr.pkey_tbl_len); - if (!p->pkey_group.attrs) + if (!p->pkey_group.attrs) { + ret = -ENOMEM; goto err_remove_gid; + } ret = sysfs_create_group(&p->kobj, &p->pkey_group); if (ret)