From patchwork Wed Jan 18 00:28:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 9522405 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 894726043D for ; Wed, 18 Jan 2017 01:24:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 784E428578 for ; Wed, 18 Jan 2017 01:24:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6ADF328581; Wed, 18 Jan 2017 01:24:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F22F928578 for ; Wed, 18 Jan 2017 01:24:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751090AbdARBY5 (ORCPT ); Tue, 17 Jan 2017 20:24:57 -0500 Received: from mail-lf0-f48.google.com ([209.85.215.48]:35477 "EHLO mail-lf0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751212AbdARBY5 (ORCPT ); Tue, 17 Jan 2017 20:24:57 -0500 Received: by mail-lf0-f48.google.com with SMTP id n124so53069291lfd.2 for ; Tue, 17 Jan 2017 17:24:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=YxN2nBNvO6xeE/JoYcU7o9hGOoscBai4+OVFwpZGqY4=; b=CXtEbTPJdFiuYycR1Ng1pHm0xhubeoUc6THIojuekE5xSHBF3ZM1ec/aS/xt9SkTzr aEaXYT01SkpS/YqXdFZ11ACBlFL5+hmx/N/xaP0/X8JXt2DBL1BElHBekm+U7LABb1ox S0yNaEjpyyU932CesePLzAhdH591n0hZah4G4= 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=YxN2nBNvO6xeE/JoYcU7o9hGOoscBai4+OVFwpZGqY4=; b=C+RCtl6cFm4uLUAyZwuHXA29DATiOP1cyW6e993WZyajwz7d/HEGWDI6SxDWi7dyZQ K6R/oLdg1K8ikVU80Weuj8ferUl2EWjiSXg4P0psW7bQDWGpBue+e9QTjk+wILZimKj8 2tZgCfrOxb+YX4bhhr4RTXPQWL+XH47wEspjgArVatiK3S5NQ1jIVr/DYEd9PjsPkZFa VRnCTdL426kwTFobMGe1GJo9PD1mopRmQivc5JLHkmqUm6FO/21tvUOf3RoOgjR9UlAS PbVO1zFw+nrdm4jh1s4BTXHnQjAxDq+T9Qxr6+rgiMJWrmDERfcLhdgr1q9KYjSeENyw rHuA== X-Gm-Message-State: AIkVDXJTXLMZA6ySc6pXGUQM92Xm4oMofQlxM10pjMKsevcjMlDgK8+RcNxiia1feJXG4OOC X-Received: by 10.25.228.91 with SMTP id b88mr116110lfh.177.1484699289934; Tue, 17 Jan 2017 16:28:09 -0800 (PST) Received: from localhost.localdomain (183-224-132-95.pool.ukrtel.net. [95.132.224.183]) by smtp.gmail.com with ESMTPSA id s63sm8127300lja.49.2017.01.17.16.28.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jan 2017 16:28:09 -0800 (PST) From: Ivan Khoronzhuk To: mugunthanvnm@ti.com Cc: grygorii.strashko@ti.com, netdev@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Ivan Khoronzhuk Subject: [PATCH] net: ethernet: ti: davinci_cpdma: correct check on NULL in set rate Date: Wed, 18 Jan 2017 02:28:06 +0200 Message-Id: <1484699286-6197-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Check "ch" on NULL first, then get ctlr. Signed-off-by: Ivan Khoronzhuk --- Based on net-next/master drivers/net/ethernet/ti/davinci_cpdma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c index d80bff1..7ecc6b7 100644 --- a/drivers/net/ethernet/ti/davinci_cpdma.c +++ b/drivers/net/ethernet/ti/davinci_cpdma.c @@ -835,8 +835,8 @@ EXPORT_SYMBOL_GPL(cpdma_chan_get_min_rate); */ int cpdma_chan_set_rate(struct cpdma_chan *ch, u32 rate) { - struct cpdma_ctlr *ctlr = ch->ctlr; unsigned long flags, ch_flags; + struct cpdma_ctlr *ctlr; int ret, prio_mode; u32 rmask; @@ -846,6 +846,7 @@ int cpdma_chan_set_rate(struct cpdma_chan *ch, u32 rate) if (ch->rate == rate) return rate; + ctlr = ch->ctlr; spin_lock_irqsave(&ctlr->lock, flags); spin_lock_irqsave(&ch->lock, ch_flags);