summaryrefslogtreecommitdiff
path: root/drivers/net/can/rcar
diff options
context:
space:
mode:
authorFabrizio Castro <fabrizio.castro@bp.renesas.com>2018-09-10 11:43:13 +0100
committerMarc Kleine-Budde <mkl@pengutronix.de>2018-11-09 17:20:08 +0100
commit68c8d209cd4337da4fa04c672f0b62bb735969bc (patch)
tree97bd375e9d31fa114418ac7b8e264b90286bcd77 /drivers/net/can/rcar
parent4f145f14f6b98b5aa0dd91bdae518b3f24f74b37 (diff)
can: rcar_can: Fix erroneous registration
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>
Diffstat (limited to 'drivers/net/can/rcar')
-rw-r--r--drivers/net/can/rcar/rcar_can.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/can/rcar/rcar_can.c b/drivers/net/can/rcar/rcar_can.c
index 11662f479e76..771a46083739 100644
--- a/drivers/net/can/rcar/rcar_can.c
+++ b/drivers/net/can/rcar/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;