Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp699784pxb; Mon, 25 Oct 2021 16:56:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOnl2+YOVwLLjgXvI0GLzOyThQWGYt5y4ho3dMWUhNM/mA+44hSYwN260IfuOMwtN/jYaA X-Received: by 2002:a50:d88a:: with SMTP id p10mr30498965edj.274.1635206216846; Mon, 25 Oct 2021 16:56:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635206216; cv=none; d=google.com; s=arc-20160816; b=CflWnxecoJ2YGMI1NXVIzdQJFEnLzDS2N7v1DpkQOdHFHkIQCZFF8/uyFFRKIi94sD kBv3POy+DglIHN8biLUO/JhLDCuMVcT/5QcHDH2Q5TTiYLwyg9aE88MxdxP9frl3Rbjy 5YhBTZi/G8wXKlBuKN4Q4pCxTqo3s447zc8HDnta1xoc2x98hmiCplW7U2RfD2Wa6Nqx eWfyAbpngmieHy58hrfbiJpjOnbKukT+dElj/ei/oLT6eEYzE+w2R5VnEk0mEsx/I/5y R3LmsPGXz8zgAL0GvI0bRxdSf0UgNO4+hwkFL/g0TLV8BHbamNatjVdVTXw7tRT05kuq mvOQ== 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=xLFQoPQ1X/jlIZ3Qb4jYioiHdZV04C49U5gd9v5/Eec=; b=FbFuj+ZFG5VD5vl7UffU5Xox2ad7VzgcPutmqcqQhi08esXwQ8QynNnk29IoYb0yGZ LBq9ENsMxMzBfLWs1Dyvgdh3yEa+YONe6mPCTI1PpE0udRe7Tqf5KYQDq8lhn1UnxorZ s3ha91Ee0gTsee5WbgC1vTJXQf9xZ8r7mydTllRkU02yfY71eTGrghS+mU78kmTUw8B7 7E8H4CUpkVODiM0HIWSz9IIZ3oMYUEhBhVhgbLIsjIK5V29tozh6E4N+tpa/iJWW0P9k 1ohsOHABwMFcGzb6zC15jdFeU/jKZ7zK5Kb43N4CntGAJYoBHIJEy5mku7hmuhznFjWO p4KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B9FfRLg8; 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 dn8si25028072ejc.86.2021.10.25.16.56.33; Mon, 25 Oct 2021 16:56:56 -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=B9FfRLg8; 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 S235647AbhJYTh2 (ORCPT + 99 others); Mon, 25 Oct 2021 15:37:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:46520 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233909AbhJYTaT (ORCPT ); Mon, 25 Oct 2021 15:30:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2BDE8600D3; Mon, 25 Oct 2021 19:27:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635190043; bh=vLMDtiIQc3byFZ9GILvjob3+0iH6Z2PEnp0OgoYDEow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B9FfRLg8hgWipAJNTsz0xYtkaSXOfGJAa/84SxHkddnvQ/NmiHGmReijIbL4E9ZMt 9txGu5mcZzUVudFFNROGEMeAYbAEpUCx4spujW73CqzDNCG2sha9xB7h5Lr/j7zAWN RYGD1fiTYz7oxismKiNVAMkE9jFFhwdKiiZIRQSc= 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.4 19/58] can: rcar_can: fix suspend/resume Date: Mon, 25 Oct 2021 21:14:36 +0200 Message-Id: <20211025190940.621863789@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211025190937.555108060@linuxfoundation.org> References: <20211025190937.555108060@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 @@ -848,10 +848,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); @@ -870,6 +872,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); @@ -883,10 +888,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; }