Commit 68c8d209 authored by Fabrizio Castro's avatar Fabrizio Castro Committed by Marc Kleine-Budde

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: 862e2b6a ("can: rcar_can: support all input clocks")
Signed-off-by: default avatarFabrizio Castro <fabrizio.castro@bp.renesas.com>
Signed-off-by: default avatarChris Paterson <Chris.Paterson2@renesas.com>
Reviewed-by: default avatarSimon Horman <horms+renesas@verge.net.au>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 4f145f14
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
#define RCAR_CAN_DRV_NAME "rcar_can" #define RCAR_CAN_DRV_NAME "rcar_can"
#define RCAR_SUPPORTED_CLOCKS (BIT(CLKR_CLKP1) | BIT(CLKR_CLKP2) | \
BIT(CLKR_CLKEXT))
/* Mailbox configuration: /* Mailbox configuration:
* mailbox 60 - 63 - Rx FIFO mailboxes * mailbox 60 - 63 - Rx FIFO mailboxes
* mailbox 56 - 59 - Tx FIFO mailboxes * mailbox 56 - 59 - Tx FIFO mailboxes
...@@ -789,7 +792,7 @@ static int rcar_can_probe(struct platform_device *pdev) ...@@ -789,7 +792,7 @@ static int rcar_can_probe(struct platform_device *pdev)
goto fail_clk; goto fail_clk;
} }
if (clock_select >= ARRAY_SIZE(clock_names)) { if (!(BIT(clock_select) & RCAR_SUPPORTED_CLOCKS)) {
err = -EINVAL; err = -EINVAL;
dev_err(&pdev->dev, "invalid CAN clock selected\n"); dev_err(&pdev->dev, "invalid CAN clock selected\n");
goto fail_clk; goto fail_clk;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment