Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp724893pxb; Mon, 25 Oct 2021 17:31:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNkuUcVQYDjEReJtHbg+bbbhDYgsBd8SeE53Qqbtj2EJS2LQ8S1IxlHWWHpHkberL1qwcB X-Received: by 2002:a17:90b:3841:: with SMTP id nl1mr4507792pjb.24.1635208267157; Mon, 25 Oct 2021 17:31:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635208267; cv=none; d=google.com; s=arc-20160816; b=N7OnKBlDtVOBGHQyBH5vEUAqSHI/RR24+/ikdzM3PekHhTQDpvzYW4q0F6Za57pTow A+AURSj60jWh11ISeJUXmUsoK0TXHQy2JHIfWkgvK76guUGbNeceYu7sVbW0mWkps0kE SuFylFZGC37U+vhOkpHhmJyf4xszs8/V1mm49TmP8DKtj2o8Yq2Q1k4OSE3dQ/cEJmRy /aTwWOE1PXp1j7FeG8dN5/SJ6v0oKgmdJMEpiiCfU3ilHd4efjO8q/XVUZV6ZIsleghS anC8ITdhUA7yO9RK5v/AIemzeQe+jJ/P/K/UlT8G7O443XepyqGUn6M9+CGwa7am+2OU 4pQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BRzcaUSl9+kk90TfXin5/4pR0XqI5PEsNyHnvwXau48=; b=x/WYI3R+aI0zm7LPy16YixfQoh13GfEw/4C1+Mx7h+sE6hh1+5ZdIQBwROQ93FtLxt 9mEqUjkh2hJbNRCbUWDRYO6bYd1oAb1lFm5qHf9ksm6zZZVtdwIzCTsseFWzoDFGcP2x A6+tbYet1eSs7/5Tc3NoMsog1kmm4Dd2+sbQ1wVGum8HgajMRNY02NtpQwrZNX9P5LxH qZvNdg7PAeU0mrJR+tpKdlsCYf5dSTk2Mb37Nj09dqdoXRfV4KHN43fyIlZmzil5TBjY Cb8vfdNFjlpopNeD+YEHTLF4P7HT/wor4Ex9q5ix1qrN7KM1KfHG+iFtI6O+EGozAs/g J04g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=W9+NyUwX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m9si25528662pgv.403.2021.10.25.17.30.54; Mon, 25 Oct 2021 17:31:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=W9+NyUwX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238537AbhJYTx0 (ORCPT + 99 others); Mon, 25 Oct 2021 15:53:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:37256 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237600AbhJYTro (ORCPT ); Mon, 25 Oct 2021 15:47:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id ADB526115A; Mon, 25 Oct 2021 19:40:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635190837; bh=sar/z/w4qR9CJKAI5xfU7jrqVsF2Lv/f8Gtqkggy47g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W9+NyUwXXPGpRsKjzSM21XZXy2q1uUjvyj6pUX3628sCDsAay6kWk70Psh8kOc+vc T3oKFFDmoZDteg3Kk5CRpppUbRkLA/VHPmInvsXQ6/xpX+pdgxHKe+9MBIwlb0qY6t 5CFAl3nVnaLaH5+6YC232WXIWSo+JosbsEHFcMeA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yoshihiro Shimoda , Ayumi Nakamichi , Ulrich Hecht , Biju Das , Marc Kleine-Budde Subject: [PATCH 5.14 065/169] can: rcar_can: fix suspend/resume Date: Mon, 25 Oct 2021 21:14:06 +0200 Message-Id: <20211025191025.768117772@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211025191017.756020307@linuxfoundation.org> References: <20211025191017.756020307@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yoshihiro Shimoda commit f7c05c3987dcfde9a4e8c2d533db013fabebca0d upstream. If the driver was not opened, rcar_can_suspend() should not call clk_disable() because the clock was not enabled. Fixes: fd1159318e55 ("can: add Renesas R-Car CAN driver") Link: https://lore.kernel.org/all/20210924075556.223685-1-yoshihiro.shimoda.uh@renesas.com Cc: stable@vger.kernel.org Signed-off-by: Yoshihiro Shimoda Tested-by: Ayumi Nakamichi Reviewed-by: Ulrich Hecht Tested-by: Biju Das Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/rcar/rcar_can.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) --- a/drivers/net/can/rcar/rcar_can.c +++ b/drivers/net/can/rcar/rcar_can.c @@ -846,10 +846,12 @@ static int __maybe_unused rcar_can_suspe struct rcar_can_priv *priv = netdev_priv(ndev); u16 ctlr; - if (netif_running(ndev)) { - netif_stop_queue(ndev); - netif_device_detach(ndev); - } + if (!netif_running(ndev)) + return 0; + + netif_stop_queue(ndev); + netif_device_detach(ndev); + ctlr = readw(&priv->regs->ctlr); ctlr |= RCAR_CAN_CTLR_CANM_HALT; writew(ctlr, &priv->regs->ctlr); @@ -868,6 +870,9 @@ static int __maybe_unused rcar_can_resum u16 ctlr; int err; + if (!netif_running(ndev)) + return 0; + err = clk_enable(priv->clk); if (err) { netdev_err(ndev, "clk_enable() failed, error %d\n", err); @@ -881,10 +886,9 @@ static int __maybe_unused rcar_can_resum writew(ctlr, &priv->regs->ctlr); priv->can.state = CAN_STATE_ERROR_ACTIVE; - if (netif_running(ndev)) { - netif_device_attach(ndev); - netif_start_queue(ndev); - } + netif_device_attach(ndev); + netif_start_queue(ndev); + return 0; }