linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Fabrizio Castro <fabrizio.castro@bp.renesas.com>,
	Chris Paterson <Chris.Paterson2@renesas.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>,
	Sasha Levin <sashal@kernel.org>,
	linux-can@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 4.4 03/13] can: rcar_can: Fix erroneous registration
Date: Thu, 29 Nov 2018 01:04:34 -0500	[thread overview]
Message-ID: <20181129060444.160434-3-sashal@kernel.org> (raw)
In-Reply-To: <20181129060444.160434-1-sashal@kernel.org>

From: Fabrizio Castro <fabrizio.castro@bp.renesas.com>

[ Upstream commit 68c8d209cd4337da4fa04c672f0b62bb735969bc ]

Assigning 2 to "renesas,can-clock-select" tricks the driver into
registering the CAN interface, even though we don't want that.
This patch improves one of the checks to prevent that from happening.

Fixes: 862e2b6af9413b43 ("can: rcar_can: support all input clocks")
Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Signed-off-by: Chris Paterson <Chris.Paterson2@renesas.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/can/rcar_can.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/rcar_can.c b/drivers/net/can/rcar_can.c
index bc46be39549d..9d93492ddfcc 100644
--- a/drivers/net/can/rcar_can.c
+++ b/drivers/net/can/rcar_can.c
@@ -24,6 +24,9 @@
 
 #define RCAR_CAN_DRV_NAME	"rcar_can"
 
+#define RCAR_SUPPORTED_CLOCKS	(BIT(CLKR_CLKP1) | BIT(CLKR_CLKP2) | \
+				 BIT(CLKR_CLKEXT))
+
 /* Mailbox configuration:
  * mailbox 60 - 63 - Rx FIFO mailboxes
  * mailbox 56 - 59 - Tx FIFO mailboxes
@@ -789,7 +792,7 @@ static int rcar_can_probe(struct platform_device *pdev)
 		goto fail_clk;
 	}
 
-	if (clock_select >= ARRAY_SIZE(clock_names)) {
+	if (!(BIT(clock_select) & RCAR_SUPPORTED_CLOCKS)) {
 		err = -EINVAL;
 		dev_err(&pdev->dev, "invalid CAN clock selected\n");
 		goto fail_clk;
-- 
2.17.1


  parent reply	other threads:[~2018-11-29  6:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-29  6:04 [PATCH AUTOSEL 4.4 01/13] iommu/vt-d: Fix NULL pointer dereference in prq_event_thread() Sasha Levin
2018-11-29  6:04 ` [PATCH AUTOSEL 4.4 02/13] iommu/ipmmu-vmsa: Fix crash on early domain free Sasha Levin
2018-11-29  6:04 ` Sasha Levin [this message]
2018-11-29  6:04 ` [PATCH AUTOSEL 4.4 04/13] batman-adv: Expand merged fragment buffer for full packet Sasha Levin
2018-11-29  6:04 ` [PATCH AUTOSEL 4.4 05/13] bnx2x: Assign unique DMAE channel number for FW DMAE transactions Sasha Levin
2018-11-29  6:04 ` [PATCH AUTOSEL 4.4 06/13] qed: Fix PTT leak in qed_drain() Sasha Levin
2018-11-29  6:04 ` [PATCH AUTOSEL 4.4 07/13] qed: Fix reading wrong value in loop condition Sasha Levin
2018-11-29  6:04 ` [PATCH AUTOSEL 4.4 08/13] net/mlx4_core: Zero out lkey field in SW2HW_MPT fw command Sasha Levin
2018-11-29  6:04 ` [PATCH AUTOSEL 4.4 09/13] net/mlx4_core: Fix uninitialized variable compilation warning Sasha Levin
2018-11-29  6:04 ` [PATCH AUTOSEL 4.4 10/13] net/mlx4: Fix UBSAN warning of signed integer overflow Sasha Levin
2018-11-29  6:04 ` [PATCH AUTOSEL 4.4 11/13] net: faraday: ftmac100: remove netif_running(netdev) check before disabling interrupts Sasha Levin
2018-11-29  6:04 ` [PATCH AUTOSEL 4.4 12/13] iommu/vt-d: Use memunmap to free memremap Sasha Levin
2018-11-29  6:04 ` [PATCH AUTOSEL 4.4 13/13] net: amd: add missing of_node_put() Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181129060444.160434-3-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=Chris.Paterson2@renesas.com \
    --cc=fabrizio.castro@bp.renesas.com \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).