Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp845335imu; Tue, 11 Dec 2018 08:25:41 -0800 (PST) X-Google-Smtp-Source: AFSGD/UuyLWxlbbAuJY0T6jX/RkDI45lJaCvLSEhaUr/30RorhSOjC5qUF7FSBaCMNIcGwCr8/fS X-Received: by 2002:a63:9a52:: with SMTP id e18mr15127887pgo.14.1544545541891; Tue, 11 Dec 2018 08:25:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544545541; cv=none; d=google.com; s=arc-20160816; b=ydjUQRY563LZUmYFDYRCeRfLHjCmudiUfDBS0HY1aQ65fgA0XifKRUsxneTNp4njXz nEKO1O8MerOlq7TRZIdETvIXB2HUWD0/pUmMQ7ZUoRNkCbycrnPHxhvSlGTrlduajhyg 7UJYDLFo/EbTx875Oi4j5XbJfkqHEsHj+DcDvAPQ+g8IjWefBmqCNM45RCsu/VZyoaYV EF0zxnq9TElY2Q2ywnAYu5fAbacFkbT6PczRqRPc3JgrLC63YPWiH1JANQhYpg7Q8hZe WoRy4y4nYtMwnsbSYSW0AejcuVUoKrduye3TqURt1bUGQKMtaMFAju91/OEIQKXr7Joi uE4Q== 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=JSLBo71i39Plle4hT9lt2rpuir1a47LKdzGUdxzUU2g=; b=YbfddmAYVXXnCAgF/k00rEU96qKQ0qebUH/5ECTM4X8UNtjrGfk+nvHKjbISZ3sxJO 2P1WcOnYdQXxAO1+c2LT1QAStxVzwpZ4HFzjIDvDRzZ0/bdQ+WwFoxhULqIyxVOOUAKW yVcA3eeZIC+R+dznZlMLbF3kBGsliN/F+YjEpeeqdFLg10k1p4N5vNXLAw8rBt8LTGvF sC9TGiEX0McZjZaBmOwQIO3SppOTYSOYonpY0Zda63dPfs/BfwrdWx9+c0pf2GdwX09w UpdBJmE+iF0hhboIzUJ8l1vxPtTUPYqyKQ1B5g0VB4i6P0MA4O5hR80L5jq1uk2oi9Q7 95+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mbyXIGs1; 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 w10si12201259pgj.214.2018.12.11.08.25.27; Tue, 11 Dec 2018 08:25:41 -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=mbyXIGs1; 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 S1727588AbeLKPnk (ORCPT + 99 others); Tue, 11 Dec 2018 10:43:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:60180 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727559AbeLKPni (ORCPT ); Tue, 11 Dec 2018 10:43:38 -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 6464B20870; Tue, 11 Dec 2018 15:43:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544543017; bh=QN7yMAoKinJeUCrqEmSQvdpfaDTdbsWnRyvfbKkCmK4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mbyXIGs1GpiPG8acHCXvcugXAM7vq8SpXukQxdZ21CvQYsEIedNDGmSUroWYBEEm1 db7Q/gQ0/ure75kiwMUd4hELZzkb0ymkzyF9iIWJh5axmK6lVLeR3XLC+eiYAtJcPk Z2LZb/FjJHHJqAmE6Bp9Bcvi/w1JZmsgIU+7dkrI= 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 3.18 35/54] can: rcar_can: Fix erroneous registration Date: Tue, 11 Dec 2018 16:41:23 +0100 Message-Id: <20181211151548.062274749@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181211151546.010073210@linuxfoundation.org> References: <20181211151546.010073210@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 3.18-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 9718248e55f1..16144e7d0c8f 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 @@ -785,7 +788,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