Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp802988imu; Tue, 11 Dec 2018 07:50:09 -0800 (PST) X-Google-Smtp-Source: AFSGD/WsiTtH4lRztsBjnnO8qXvauC1SQVXOj8pfdjMoIJGOmLPGfEtZIx8kP98BwxIHSWxbJzSW X-Received: by 2002:a63:5d14:: with SMTP id r20mr15105380pgb.329.1544543409652; Tue, 11 Dec 2018 07:50:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544543409; cv=none; d=google.com; s=arc-20160816; b=KMEwSEaJYei0EzYh85Ivshqzv+PTTDwr50yI3u+owvz5v2zeHrrNwz39GwwdF9PhMu Z9nNR1ZKmmALNUbSxLgp4MiG9lz98bfvVm9p18VwIC07erw2jciT8FmJlXbzP3hkZr/I 95eb1nArAjkIfe9i+5304HmygG0MWybcuCPAHZLKf53Yqxej+EQ0vvriO0RDDh4sMU67 Inc5YOEKj9GqqGEQocP4DvfUnm4Mbs+ql8acQFBkf6P8/UI7XJ2IJS1nMEMknclqN7U+ a6vO8rzMY+1cWIuqgZVGnIb3Md0VP28JRUK857z+kTJbOHcleLqlOVbRGXu8ukNJznD+ uQlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/tpAke8liUgn0/JQkhGfQ9wXHpmbvJQCkqCu+UNfnO8=; b=jv42L+DHoC6Uh1uUt/t9Pf/tbMLJMmrT5+H6UaC+Z45eDTgtp/AWRYvaPPQnd/R8I0 l3wMySs1ELftdqtx7fK9tn/QgFp4WQdy2/XpQIxKioJ+eG776ObFKivjZFisAYejtD/V foEFlhcq0JZf6R5g62HL0MBIij6qeNCdqkyTaljIuXTnUCryH/YVZlCKSurTd31PwK5i XvAqZ88QE909yblf/DhWu9qjkRwZVD0VatPTRWREUC6GXYrt1h99Qa7unHiEbN/15Lvp hJ3iC9JU0BKFe4kfaQ3kQv1R2oXC6/CD2fFInoqkTcSghsZ9pRn8Pcaia1zFCZNXZ3Sb WPpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="TGWMOB/+"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id az5si12439120plb.166.2018.12.11.07.49.54; Tue, 11 Dec 2018 07:50:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="TGWMOB/+"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728459AbeLKPrF (ORCPT + 99 others); Tue, 11 Dec 2018 10:47:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:35382 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727048AbeLKPrA (ORCPT ); Tue, 11 Dec 2018 10:47:00 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1D1F22086D; Tue, 11 Dec 2018 15:46:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544543219; bh=O2ExPM73cQ3Bf0jfrv4NyCd3NvVMApox6/sdFZAVqXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TGWMOB/+ZryBt5qAarmfe/uAyAZ+dBur10d23HFwPgki7wYN182bu2dwr1/+ADbJP P5JtCUzflimosKwP38s6lGCHHbgVPvpXHYaSmDCLGQid3rNU0xLuwA/5tVGob2RSBp F4ymlWPXzfwfzojPpkk25auxG48o/OT2ukzrYYXE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabrizio Castro , Chris Paterson , Simon Horman , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 4.4 59/91] can: rcar_can: Fix erroneous registration Date: Tue, 11 Dec 2018 16:41:18 +0100 Message-Id: <20181211151610.845687444@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181211151606.026852373@linuxfoundation.org> References: <20181211151606.026852373@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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 Signed-off-by: Chris Paterson Reviewed-by: Simon Horman Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- 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.19.1