From patchwork Tue May 28 17:45:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 165313 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8787662ili; Tue, 28 May 2019 10:45:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpvI1BVpkLtc1l6lTS8GtHnWwtfOfrFMO9hws/3f1gQMYt8D8WLsgy1AVNCREm7Fy/i3XN X-Received: by 2002:a63:5351:: with SMTP id t17mr3247958pgl.152.1559065526976; Tue, 28 May 2019 10:45:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559065526; cv=none; d=google.com; s=arc-20160816; b=RT3DMzcdyuFL6XFd4lzp6hQ4AePi1AFjehb2PLD6rOxklDhW3IfXtqBUJ9vTRjIwqB r+xEmVi2MlhyD6pl0ZdseAP7v0MyLEnOPPZyBCw3azzxU5QyVMxH7vhdiDhZFtLjZR8l oTB2AyHeGiBhdaRUOO/F4AcR70OkgsBWao0zQZrOg3/2D1e/1iqHMXqo/mP1cErJ080A gt8kBYa+Sv3ESg5DBBaZ4JzDGzqBZPrpVitaetXvKRq717oOuIE+mqJXD9mCmztigRsp 7NopBQ2695h7DikW5NkbygrIpsDDizo4A3c69i5QXm79/5GmN+HxHPO1lqLVP2O9XHjl 0ZFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=RXcKDhl1/lg8QsNl5iEDoBd0XtlOjaQwgqCDwv2KMDg=; b=V9k8YFtl+zFrlrmWrYwuB/i3LrhgCVffICkz6GUqC3lmBNyuIs+6Co9mGXmrbS7cKU 3LzHyt5Xkrw7dumAMJJ3FHwwyVdefbehqKQxgCagZLPlPEqe4rNueV3W8zwwOs45CPJ7 JZt3MPo7uhPWxClMkyWMcZXYCcSSm6vOpD5sXaySH9KFc7gs2VNrKEC919aNOMwOjtDC WaiMeUWOZAav5Y7RL6iF8RsJVit6TpwGliURkzcoNrDQp+MOGBGmEi4sW35G4Gqw3G1w 3L7jVnlx2+vXJiJNXwbI+Ty4sQR1rilAOy5PxDqoTR8Rd9BAimrOJRw25oxHK9L014IO Jgtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QHdeLAVs; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y12si21787119pgr.329.2019.05.28.10.45.26; Tue, 28 May 2019 10:45:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-omap-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=@linaro.org header.s=google header.b=QHdeLAVs; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727246AbfE1RpZ (ORCPT + 5 others); Tue, 28 May 2019 13:45:25 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:36020 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726827AbfE1RpZ (ORCPT ); Tue, 28 May 2019 13:45:25 -0400 Received: by mail-lj1-f193.google.com with SMTP id w16so925792ljd.3 for ; Tue, 28 May 2019 10:45:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=RXcKDhl1/lg8QsNl5iEDoBd0XtlOjaQwgqCDwv2KMDg=; b=QHdeLAVsj/k0xgjOu78MvnPoW0OGewTnKPEDc6yXnK0I0QMUhgvXkVtehPtfqq3rQp z/jVEBJOswzVIzCI5f4daULX+2taP8XtYqpBQbCZUm/7rQiwCUFaNxFcyENCEG7wNGQZ vKrx8mtFPGGuhdhDpK6WiHcdSbeJDEvD4EHpRVGXbo6VURcLKZvlJMrijPkYvY0NYULd YOxG03EVdbngWJOFUTgQr7B4wbxDuN7shGI7Yd5anwxniD8fYYabJm7eJfm7RyEzJaM3 cE/X9qFpQi9Dxeag62dTbnizFN3F3F5g+eMhSxVYvotkEy+dkYpVRC4s8ORlN6wr/qRo tTtw== 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=RXcKDhl1/lg8QsNl5iEDoBd0XtlOjaQwgqCDwv2KMDg=; b=S22BlOkBnnlxHcFJMQIbZRX946lFzr5VSv0GBR1A4iFHUIisbjiwUM9fjU4LVNtRqY 6thxxzwKwZIYvNivLi8FyPLy1I0WqevqB/zj3kFooUP1wjvTRSOQ5+2/EEMEHKi2KA3c evPzoO5Ob5jBKi98GUBL5iDdyovvGgTFKToSza1xe6WEpwKKR2wxQ2jb9uOiYU3v9OJg RbkJ7XDVmdpeudpbX13J7SwObZDwfY69MNlXu0iqhhj8+KERiagXU2ePsVqzzB7ThjYA IXA15F+xIkit9luGDhuAJLKwKbcA3zfklr71eJu/YuTPj3Xyr3H/9mg9UY5fNQHVmZVq Td6A== X-Gm-Message-State: APjAAAVGNSGMdyHhvOfnXjk7Oy128we8ksBsZvyJ2V/h4o8RtQY4sR/D rk6ownejqR9JBL6cpC0VnQJEaA== X-Received: by 2002:a2e:9410:: with SMTP id i16mr36430055ljh.152.1559065523333; Tue, 28 May 2019 10:45:23 -0700 (PDT) Received: from localhost.localdomain (59-201-94-178.pool.ukrtel.net. [178.94.201.59]) by smtp.gmail.com with ESMTPSA id x16sm3042049lji.3.2019.05.28.10.45.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 10:45:22 -0700 (PDT) From: Ivan Khoronzhuk To: grygorii.strashko@ti.com Cc: davem@davemloft.net, linux-omap@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ivan Khoronzhuk Subject: [PATCH v2 net-next] net: ethernet: ti: cpsw: correct .ndo_open error path Date: Tue, 28 May 2019 20:45:19 +0300 Message-Id: <20190528174519.7370-1-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org It's found while review and probably never happens, but real number of queues is set per device, and error path should be per device. So split error path based on usage_count. Signed-off-by: Ivan Khoronzhuk --- drivers/net/ethernet/ti/cpsw.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 634fc484a0b3..6d3f1f3f90cb 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -1423,8 +1423,11 @@ static int cpsw_ndo_open(struct net_device *ndev) return 0; err_cleanup: - cpdma_ctlr_stop(cpsw->dma); - for_each_slave(priv, cpsw_slave_stop, cpsw); + if (!cpsw->usage_count) { + cpdma_ctlr_stop(cpsw->dma); + for_each_slave(priv, cpsw_slave_stop, cpsw); + } + pm_runtime_put_sync(cpsw->dev); netif_carrier_off(priv->ndev); return ret;