From patchwork Wed May 10 17:28:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 99011 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp340206qge; Wed, 10 May 2017 10:28:25 -0700 (PDT) X-Received: by 10.98.17.92 with SMTP id z89mr7577352pfi.185.1494437305088; Wed, 10 May 2017 10:28:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494437305; cv=none; d=google.com; s=arc-20160816; b=0HcDWI2MBU4z1QAStIkjhkvHeUuhB9x8NyVYwrWlbLlCKcQ8nUo/MX+O+LfrvLZPXi maToJPu6w9mzllK6VwamULe2SwKroQDpmzWH9cLEK6T566QWlZjmTOPlUnnNUdb2EjxA uIdE9YbLdyJ1btbjy4q8jumruq7OuRIwuZgdgTmbVXLwMWbAACzMzuqTt2g7+8eX+lf/ cfLk+TlNsrul0utpg+6y1u/O9mg9bC+q9DD60SfipPFKL2xcyqdRKA8PvI+qGXKCEo84 co3VgiYFo1pkOoUYIhh5qghogFp4MZVQX/mgJ4tT987ISQc9oTysbsPmi+pReDyhr9Bb rNkQ== 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:arc-authentication-results; bh=U+G/M9EGxlYA+q6gN5u43A8hwaH7LMC9GrtoGeW90ww=; b=ZbMqNnIWnWDvcQ+sTC1bskKfxzgSqB2GI2N46VnsTznKo+nbhMXD44ecNlXu+LHJuj kz+ZekGbIWDExGj9/eHcyl9B27mmrZ/2C/d/Y0sKqeNFBG0Y0R1Li8wU+b08c1vGEN3i q3A93DaUbzLd19YfbwA2ttB4BrgClVDMXfieOAuzYSiGgBQ2wOpkdOETmnQm2KgbhX+x C8PVtGZRUgRHQjVOc8xckH7l/+Gy104pjh7JnJ7X6VgqC0z0JAGFri7t2FwRvcSK8jdx xQ1dP5Hp0JFqe0Egukzw0kgzoS5z2eC6h0RuyKMQazvyyoEn9r8ai1pp7oVO4kdRiAmz GSVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; 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=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 z61si3481737plb.68.2017.05.10.10.28.24; Wed, 10 May 2017 10:28:25 -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=@linaro.org; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754478AbdEJR2L (ORCPT + 25 others); Wed, 10 May 2017 13:28:11 -0400 Received: from mail-pg0-f45.google.com ([74.125.83.45]:35650 "EHLO mail-pg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753885AbdEJR2J (ORCPT ); Wed, 10 May 2017 13:28:09 -0400 Received: by mail-pg0-f45.google.com with SMTP id o3so1094316pgn.2 for ; Wed, 10 May 2017 10:28:09 -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=U+G/M9EGxlYA+q6gN5u43A8hwaH7LMC9GrtoGeW90ww=; b=T2LBPYT0rF+tQ+1pHbodEtAcoVf3MIEK7M+xFQZ30cpx4EsIuhC5fzswpIB5KqEQEU CbylK/qXhsVB8dcCY4ZclwA6L3ybRVWG3CpKZY2adBmgKI47bEuvExqaTbo5cqjmKdt4 slUj3iXdVR5Wt7/Eg6XsbzWyF0LNUMaDEnTUE= 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=U+G/M9EGxlYA+q6gN5u43A8hwaH7LMC9GrtoGeW90ww=; b=dYopoVMQ8+WdaW1596Wkv8HOaAfGfFDz7ybPd+nZ7GOkjuReUgxUXS2PnXu/fx8p2g 4Qd1rSMA5RIR4eF0LVycw7+x0RLFFjalg0pxCa9BLGM3pUlawTjxTS0jjKq9mNIoJM5i TKwaVWtzptoVc3yTfUZ+RdpdFIRdUtI9ile+qhRqmZeIGBYbmtBdBRBoggaQg5caayJ9 Mt1FYeFrDBxjXvtKf5pjw2rsAelyIqN3TA21dIFimqBNvu89QeqhuFUaVvqNkCXWcP72 HPMtaevQRdIO28RdGXV6dkgu5xvs2XpJZDsOe2gtdYqra5rbuH/LTo2DzXcJ6dw3DoVc pfwA== X-Gm-Message-State: AODbwcAhce5MbDNbhsyfch3X2Gfj1V22QJqv7lsAIa83uwh5wFwdZpuY 1Ame96HXRiE5epTFYPV0uA== X-Received: by 10.84.178.131 with SMTP id z3mr9682195plb.175.1494437288487; Wed, 10 May 2017 10:28:08 -0700 (PDT) Received: from khorivan.cisco.com ([128.107.241.165]) by smtp.gmail.com with ESMTPSA id x21sm7236473pfa.71.2017.05.10.10.28.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 May 2017 10:28:07 -0700 (PDT) From: Ivan Khoronzhuk To: w-kwok2@ti.com, m-karicheri2@ti.com Cc: ssantosh@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ivan Khoronzhuk Subject: [PATCH] net: ethernet: ti: netcp_core: return error while dma channel open issue Date: Wed, 10 May 2017 10:28:05 -0700 Message-Id: <1494437285-13839-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix error path while dma open channel issue. Also, no need to check output on NULL if it's never returned. Signed-off-by: Ivan Khoronzhuk --- Based on net-next drivers/net/ethernet/ti/netcp_core.c | 6 ++++-- drivers/soc/ti/knav_dma.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c index 729a7da..e6222e5 100644 --- a/drivers/net/ethernet/ti/netcp_core.c +++ b/drivers/net/ethernet/ti/netcp_core.c @@ -1353,9 +1353,10 @@ int netcp_txpipe_open(struct netcp_tx_pipe *tx_pipe) tx_pipe->dma_channel = knav_dma_open_channel(dev, tx_pipe->dma_chan_name, &config); - if (IS_ERR_OR_NULL(tx_pipe->dma_channel)) { + if (IS_ERR(tx_pipe->dma_channel)) { dev_err(dev, "failed opening tx chan(%s)\n", tx_pipe->dma_chan_name); + ret = PTR_ERR(tx_pipe->dma_channel); goto err; } @@ -1673,9 +1674,10 @@ static int netcp_setup_navigator_resources(struct net_device *ndev) netcp->rx_channel = knav_dma_open_channel(netcp->netcp_device->device, netcp->dma_chan_name, &config); - if (IS_ERR_OR_NULL(netcp->rx_channel)) { + if (IS_ERR(netcp->rx_channel)) { dev_err(netcp->ndev_dev, "failed opening rx chan(%s\n", netcp->dma_chan_name); + ret = PTR_ERR(netcp->rx_channel); goto fail; } diff --git a/drivers/soc/ti/knav_dma.c b/drivers/soc/ti/knav_dma.c index ecebe2e..026182d 100644 --- a/drivers/soc/ti/knav_dma.c +++ b/drivers/soc/ti/knav_dma.c @@ -413,7 +413,7 @@ static int of_channel_match_helper(struct device_node *np, const char *name, * @name: slave channel name * @config: dma configuration parameters * - * Returns pointer to appropriate DMA channel on success or NULL. + * Returns pointer to appropriate DMA channel on success or error. */ void *knav_dma_open_channel(struct device *dev, const char *name, struct knav_dma_cfg *config)