Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2921077imm; Sun, 13 May 2018 00:02:46 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoiMv0I+XKcxkDeMNjXHGKozHKQvCjagEw6hxkmYhJFUSTInB6MNqNamQziWToUy7po0116 X-Received: by 2002:a17:902:ac1:: with SMTP id 59-v6mr5104939plp.367.1526194966239; Sun, 13 May 2018 00:02:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526194966; cv=none; d=google.com; s=arc-20160816; b=rATIwOyMRUMMG7dt1AZyzJlwXsmjNmEygY80M/IsvfZo1faJsguM114GF0UuEdwjhc +VM95sPBtaGJ89K0QFXE3GYbZs4XflBfpHlbsGGJdiRGXPsgMV/Q15xVh1zYzfKDoIcE Ens3LxQKO637lOYPoe7lXN5nLPagZCYs5PAHw+PXJMBcnheP5vnIuMkCRHNA9aRYiaCH 8R2hwLcEdaYrzZ1iGSlCLFFTUZQc45A1nnhUFJHLB9yDwj2MUkJR3YQC5Zni/N9FqbaF t0V4NZC09sbxRFfKjjJtziIw6hYQ+54wlHkog6I0Xt9ACxs4dGqLvASMOik8M27s23JK pvVw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:dkim-signature :arc-authentication-results; bh=4XLsJBdwbgcFHMlEP8bHrz/+nfHBTIFX4Q6C1/EF25M=; b=xid55/U+vRpu/PRw9VDOZ/i6Re6wRYEqWncoiu7NTnOPJs5Z5JHrmm4Wq6+0EDb+4u +alvqOPkvupaxPd2gEm0FQGxmsdRwWaLo5UCKipKAJgMMjHRT4VahAJCjwgGGbOHRfQi Oo1rJABI2503pff2YaqfWlyUp+Ra5RUatgLZ3i6GYdwJjE7H7e1sM1tBcjIX8/oLTaGT HN1mHEfKN5CKfLaTujOTq9n5ON2zcORlAs7DmubYWid8g7UCi6/EdeZwccRBsdKi+lp6 FbYfRnz2DD7mGQkte0oTWP+TLV9tO6GkZSGFm17MpN78lPkb2JA3W2g++uxCw/xHU1dR 25Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=clWK5SFO; 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=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 s129-v6si7398820pfc.33.2018.05.13.00.02.31; Sun, 13 May 2018 00:02:46 -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=@gmail.com header.s=20161025 header.b=clWK5SFO; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751533AbeEMHCN (ORCPT + 99 others); Sun, 13 May 2018 03:02:13 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:32895 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751022AbeEMHCI (ORCPT ); Sun, 13 May 2018 03:02:08 -0400 Received: by mail-wr0-f193.google.com with SMTP id o4-v6so9059297wrm.0; Sun, 13 May 2018 00:02:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=4XLsJBdwbgcFHMlEP8bHrz/+nfHBTIFX4Q6C1/EF25M=; b=clWK5SFOiU/tI3U10LkAgwyC44Xw/Dj6z4kyqeqqsUlFojRnT2jQNWqiKopLw9JLVo 5QGNlnX9TiDsIaMEndYEFEucxTeqId9YIarm83JOjRuegW4Hx2RIFMTHKZ7MZhUH/9jj /LWo5i+nNO3tO+H4YG9FXr476hgh271i1hfOVDqvudZJFRRkUF9nz8ZXmed0/1lOMLm6 1dYoinex8O1MK14byLbaNOwiKUXvZvByaiLFabMUHGQ8lFVCQKITYQDzLxD+qEL6G6BM 8FqqqywUb+aeQZCaRqp2Eywt98USLCbjuse3KRrP8bb6mljVgdaEbCqzqUkOn+6Zm1t6 14Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=4XLsJBdwbgcFHMlEP8bHrz/+nfHBTIFX4Q6C1/EF25M=; b=jKeMX/hNNqhBtJbBAxkqUCQb4O/Kat/IIuzQ27zSQ9/z9nDXipXnXQtAwUgk8JcqYJ o9RTFnnHySpDzWUUbVQGjZ5SrNY217uB9z3csLDTz2fUpfTz6Sg589l/XWUg8OQo5eqp eXiKyFqEcbvW2ASZ2CmtlBL7bTkujwMpgB4L9oBQsMzP1gBDLVEmguo6NX5FZBo3UDiM Pq1guzaVBYfKs5C4hwQM4soGtbdnwb9QKzNUdSqYG28nfodeTAS82C+ISH7XUzv110tX euT7CXvdSjJYaRQDhnujQ5nXPc8JeCxYAlNOhMhASGTVA8+QJXv4eF+ZhdDktQImUqhT 7ziQ== X-Gm-Message-State: ALKqPwdf8DFEugYe8IgUiGLxIOHRFFJ0u7I6FbDct7/ioDk7OCzigLHy Zb3Ll/Qt/MHPXzvAZKkeZOTohcyX X-Received: by 2002:adf:8505:: with SMTP id 5-v6mr3460953wrh.77.1526194927015; Sun, 13 May 2018 00:02:07 -0700 (PDT) Received: from [10.8.16.249] ([193.47.165.251]) by smtp.gmail.com with ESMTPSA id j76-v6sm7015447wmf.33.2018.05.13.00.02.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 May 2018 00:02:06 -0700 (PDT) Subject: Re: [PATCH] net/mlx4_core: Fix error handling in mlx4_init_port_info. To: Tarick Bedeir , gthelen@google.com, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180427152015.185861-1-tarick@google.com> <7e5d6d30-ed89-8a8e-55c1-a25897937727@mellanox.com> From: Tariq Toukan Message-ID: <85680666-cf07-2d88-328a-d676d71a403a@gmail.com> Date: Sun, 13 May 2018 10:02:04 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <7e5d6d30-ed89-8a8e-55c1-a25897937727@mellanox.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/05/2018 4:31 PM, Tariq Toukan wrote: > > > On 27/04/2018 6:20 PM, Tarick Bedeir wrote: >> Avoid exiting the function with a lingering sysfs file (if the first >> call to device_create_file() fails while the second succeeds), and avoid >> calling devlink_port_unregister() twice. >> >> In other words, either mlx4_init_port_info() succeeds and returns >> zero, or >> it fails, returns non-zero, and requires no cleanup. >> >> Signed-off-by: Tarick Bedeir >> --- >>   drivers/net/ethernet/mellanox/mlx4/main.c | 4 +++- >>   1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c >> b/drivers/net/ethernet/mellanox/mlx4/main.c >> index 4d84cab77105..e8a3a45d0b53 100644 >> --- a/drivers/net/ethernet/mellanox/mlx4/main.c >> +++ b/drivers/net/ethernet/mellanox/mlx4/main.c >> @@ -3007,6 +3007,7 @@ static int mlx4_init_port_info(struct mlx4_dev >> *dev, int port) >>           mlx4_err(dev, "Failed to create file for port %d\n", port); >>           devlink_port_unregister(&info->devlink_port); >>           info->port = -1; >> +        return err; >>       } >>       sprintf(info->dev_mtu_name, "mlx4_port%d_mtu", port); >> @@ -3028,9 +3029,10 @@ static int mlx4_init_port_info(struct mlx4_dev >> *dev, int port) >>                      &info->port_attr); >>           devlink_port_unregister(&info->devlink_port); >>           info->port = -1; >> +        return err; >>       } >> -    return err; >> +    return 0; >>   } >>   static void mlx4_cleanup_port_info(struct mlx4_port_info *info) >> > Acked-by: Tariq Toukan > > Thanks Tarick. Actually, you need to add a Fixes line: Fixes: 096335b3f983 ("mlx4_core: Allow dynamic MTU configuration for IB ports")