Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp688946pxb; Mon, 25 Oct 2021 16:42:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEt5p9A3nHOAqZPmUCcQYfDOjvzhe0/8Xm0Fu6N2SQJ+hN3kK2GD4HXqJqhWIetiwwOc25 X-Received: by 2002:aa7:da53:: with SMTP id w19mr30707351eds.268.1635205335092; Mon, 25 Oct 2021 16:42:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635205335; cv=none; d=google.com; s=arc-20160816; b=WOutH6thc9nT68b6FUdE63ACCI2pPyeGz4ctN8Nk03PxHOhpsrCZheHvMdt1Ia/895 Wz/xKqTngq3ZkEomvtEkbaCnU002fDdZER7o/syZsPMqFC8YcZA8IF5GGwc+mI+JmsgQ 474eQ349eaIbGHqWsvcy7N1IfFPleQHU3p4eQHaUuUalEe/v6WiNcTbzpjnjVijNy/BZ cCd7iWuy4vtOsLV2nt0yYDGAMaZM6Bb7YchqSkhuDSx5AQXTcbTunVpadzTak4CA3t6U T1PD+WBEXJWDSU4o8XH2pGaCBFqbcmrqLqZd3tgQwH9Xr24q7zV5vizsKrnco6rBtEZI X/Rw== 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=1EQnO8+ntLkucz0XrFGiYR2Y+PTg0IqWvxdwdG6a000=; b=E8s6vtTk4oKr7wcMGS2A1qofp/8rAYeh8kQcE6kHEEnCxEn5jvPOCP8ACy2bFEeNqY yS4xs+TKcehjwMh8ok5jViionhoknfP4sv63NL0s+q+YJZW656KxHfsnoucTKI98l20c 6GwywrMsG2UF2N7MSjcyhJ2U5o0fHtni2UuWWSMxD6ilPxE2WTV4sgPOENfVyuQHHs+l u4Nstdtj9hUxG30ZLTrkqafsAxriwLjVBXa18pyDKZEtkCg7zynwp582Idt2q14UFA7n NYa3tZyNkKPr5OKriXU37wkw68XQaZoEQP/U1VXACSqGKfylsLyN1ur7BggB3IeaYhRy F/SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DaXsEMTq; 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 qb34si31887429ejc.603.2021.10.25.16.41.50; Mon, 25 Oct 2021 16:42:15 -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=DaXsEMTq; 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 S235937AbhJYTag (ORCPT + 99 others); Mon, 25 Oct 2021 15:30:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:43206 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235097AbhJYT1p (ORCPT ); Mon, 25 Oct 2021 15:27:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8BE5560EFE; Mon, 25 Oct 2021 19:24:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635189868; bh=iXn6Jih01pc9c2ujcf4Dm/YwYxbow9CFLEPGx1h3crU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DaXsEMTqWt56+LhqduWuCsIk9eN6Ao52dJpMmjuYzqY2m8EOULpW5BwoeBImW+AEW LkIiPBnPs75TK9s0GwZx7fbiXW0b0jmQ90AoGf7Jtep0/MbaaYEjS/Y14O7UCwoDFT P3TnQ7o/9B1mZHHBwuAcptpqnPktjFSucw1rhxbA= 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 4.19 12/37] can: rcar_can: fix suspend/resume Date: Mon, 25 Oct 2021 21:14:37 +0200 Message-Id: <20211025190930.658769124@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211025190926.680827862@linuxfoundation.org> References: <20211025190926.680827862@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 @@ -857,10 +857,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); @@ -879,6 +881,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); @@ -892,10 +897,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; }