Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp613212pxb; Mon, 25 Oct 2021 15:00:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXfGTHQI0+uhEoZecWc+xmG0hrNU16S+5nB3iPMNkt9tXsIjEEm4holmfM5A0h0rbhlwwK X-Received: by 2002:a05:6a00:1353:b0:47b:f151:e084 with SMTP id k19-20020a056a00135300b0047bf151e084mr8381382pfu.46.1635199238276; Mon, 25 Oct 2021 15:00:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635199238; cv=none; d=google.com; s=arc-20160816; b=NGhOIyRI+JNppriN7NMCKAvWDw3/tSYAjUOEe8Ioi/XbNGVOPvaVb2b1zoM3lWI5Uu IGLz3Or7dNBuX5DvhCvg5uRAcEnAoyDAFG2bcHnPdXAWDf9xyZP38oiWm6zvLTfie0xd Z+SJis6jqRL0yVLLnJ7RrEMhIZXUmVu8KZQunHPy4Go/wcMuPPc/Rrznf2+ajYCfl0lu OcSOtIzjrXC8GgzmnC0iLwMstgsOWsp8qKDunAEwM85ZidBgtkvVWJ+gQKMLIG6UjIVe pIA9ASepRiziMJi55WzdqLm+ME93Uy4DLn07dGd6oD0p+M1ArNWMRR4Ud4dSdkB50JIk K+rg== 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=cC47R0li4mW/6nFHFCwIRSJcbCNgMhwOpjN6o/XK4uc=; b=Mn07O3EX+7ScD7KHVzvqmTZUw6tJvMBqGNeaRb9RN/vjHCGrrNltJRJieVQSrJTipm LeWgtu8Pbke13rfgnYLrppbH5w+ZYHEgIODIZEh15RcNnJl5FdpJaE44vTceFQU3BMHY z/Yf0C0bk5w+nvopV6aKOebdAkJpcmxCp7vTznILZSAGBgGwDNpLp5zL24oN/nKQasDO L99HcWTAcwCP/DfwoY30WEM0+XJcsE6zpyReww7x1yvrVMCUBZYG3m6XG2ZtWdjaNhmb 6/wkAa4s9nV8juEDyF9KJ3PFWpip9zDisRF4QNB7mvNOZMp8SzGpmBWyVg+xlUMuDGGy 96WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZZ7OLWYv; 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 c3si13838512pll.154.2021.10.25.15.00.23; Mon, 25 Oct 2021 15:00:38 -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=ZZ7OLWYv; 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 S233982AbhJYTT7 (ORCPT + 99 others); Mon, 25 Oct 2021 15:19:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:37228 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233898AbhJYTTT (ORCPT ); Mon, 25 Oct 2021 15:19:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 584746109E; Mon, 25 Oct 2021 19:16:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635189417; bh=/desbmmpXnkLDbK6CAmSzQ5SsP5pNALb0L2KWottV8E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZZ7OLWYvg6lwGR8wIgSmjrP1kklLOCLpfc4Cpk9tVf38zCJw+pwCUFf+aG9wyJZ56 E1XPy422o+wEAWKpBMQD8pDbKeq4JyvQEIU7N3a7eUnpEML21SLcq+CIPtiPoF9VTr uD2ohcpH5n5D+79EkcOJlunuqQWa43laRlk5fzSY= 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.4 26/44] can: rcar_can: fix suspend/resume Date: Mon, 25 Oct 2021 21:14:07 +0200 Message-Id: <20211025190933.933435129@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211025190928.054676643@linuxfoundation.org> References: <20211025190928.054676643@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_can.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) --- a/drivers/net/can/rcar_can.c +++ b/drivers/net/can/rcar_can.c @@ -858,10 +858,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); @@ -880,6 +882,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); @@ -893,10 +898,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; }