Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3476017imj; Tue, 19 Feb 2019 04:17:17 -0800 (PST) X-Google-Smtp-Source: AHgI3IYLoVqraSRsURp8vGlVHHIXAsJ/J0mhqYeQixnsQANRyFvYEV3meidDGZca5IrZNSBoxYqR X-Received: by 2002:a62:1981:: with SMTP id 123mr29074979pfz.69.1550578637651; Tue, 19 Feb 2019 04:17:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550578637; cv=none; d=google.com; s=arc-20160816; b=WvXpezde2KvA1F1K4nAznUvAe6vxwXeIzmpPs3TtMRilyg89EQpWL8lm/MYURxw8tY siderkPwyYHy4g7hKXXnAxvVdl7icwROiQTEiSTdtba3f2IDsg76shMagUAdx19/KSdG 9RgVhFhojOduVg9s3X4C/nra+PvUWwKpZcpuWNRWlxxbQ6iEgHbxkXql/3MEcJt8MwCx +QlB5eXIKpzgnI0/PE1dKxhGI+RcBU5FxjXY3p/zS/7kbgU9sh/f1/Y+G9vDnayQTBkh TlHae5hlptd1CByiSpmQGmr2srCKdTOIbKl1w2+HaXWuPMeNFHcPUs/o+P1peTa7esYu jY+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=qjtegP6eXeh1eBEfCJW6T14ShtJcZpHiRQp/StMhw6E=; b=RRwki8ovkUY3SGKvD8IlcX9Wa6JMjtpfYl2zF22VaPdKb6ul05vjeL/s5LDpxO1Pr1 4Qw5KVqzV5eG3NIzyKzOSM/p836JUHXIWofCve35wT8r8LY6zqr32f0h4nXr1A+FcLof CJ6uSmHQAd+4+4KR26urFe0M9jwAuVb9Phlhg2WxoxYz7S+09+SwM7guE7ici3YFRInq PdTenMmnUCdWxDbV0T6eJ6C9Ehvas9/I0PZKXUSCAiikTOKWeqxSYXvAVcQW3iEjPAEA 2ue5APILMyJy8tttPYshPWaSzOte48hfAEwY7OiWWfQ7um+p+ZTGnqWKm6l7Y6R2ldgb 8q5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=N583wQoJ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j24si15107469pff.186.2019.02.19.04.17.02; Tue, 19 Feb 2019 04:17:17 -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=@gmail.com header.s=20161025 header.b=N583wQoJ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727991AbfBSMQN (ORCPT + 99 others); Tue, 19 Feb 2019 07:16:13 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:38809 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725805AbfBSMQN (ORCPT ); Tue, 19 Feb 2019 07:16:13 -0500 Received: by mail-wm1-f67.google.com with SMTP id v26so2472507wmh.3; Tue, 19 Feb 2019 04:16:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=qjtegP6eXeh1eBEfCJW6T14ShtJcZpHiRQp/StMhw6E=; b=N583wQoJU6fegGrgO+JW0CB8QVzvRo9j2WzXTwgzhhBdLPrFBfolpSprmi3OwWabhX AXLkSI3hhuBVXm1SVhGWSnD+uqpTGtlCpbVOrMJkiUQ8oiizltvJFlfQCAcS8PDl5ZDD O3OW1dTWFzQW8wTjyVpsp7lKnnLlg9uxrMcJ9QjG0nKQ5ySEjV5BDAepJgSj01a4VMEc wbfniQABJXnZt2YLVdbCgS9s4QSx+vvT9/5BxoBuw95fdhUEuH8qh/xPWHIoO3MVbbcq 8gYLB6L284MMMvkCVBKDLVL1J9/EmxYru+9qVb775AN39zV+UaPNTg9t9K+23b613edb RopQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=qjtegP6eXeh1eBEfCJW6T14ShtJcZpHiRQp/StMhw6E=; b=fcGabhEOlAvY6+H6BJvqv3NwLKCAaci+OZDdLnfVlTyRRaIKxq6k0dYBiYJ/10sLqI ZIe/KSTRtuzfIywxEYrabjyrsRo3GUMX9Vz7vrDGVt/pgUZm1aQ7IqnCk/Usn+cbb/sm wj2lQYtOUIvGJRfapCG9O5wLT41y6JXAN937i5cht2XSw0Mh94HLJhejUryJnAskcNE+ YzzzS7tDvJb7ujtGXuUPqtFTBDWCwhpL/QA0E8vf33fkgAfUAFHfHQHrNJ4JEJbvVpZi M01tnN7diagtK8qJBqMJ42KyXQ2kohVYVDfBKa6uVcpFZNRi2thY7VdQfsoYYMcJMIBc x/vQ== X-Gm-Message-State: AHQUAuZ3F3z8j1pIeIzFB5HNipY1eA1qihfPrq8hwS//7uLiGf52m1Hb juNF4/DhwkH2SC39spHx8FGuy9QN X-Received: by 2002:a1c:f319:: with SMTP id q25mr2705484wmq.151.1550578570321; Tue, 19 Feb 2019 04:16:10 -0800 (PST) Received: from localhost.localdomain ([2001:470:9e39::64]) by smtp.gmail.com with ESMTPSA id a1sm14783353wrq.96.2019.02.19.04.16.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Feb 2019 04:16:09 -0800 (PST) From: Jonas Gorski To: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Florian Fainelli , Matt Mackall , Herbert Xu , Arnd Bergmann , Greg Kroah-Hartman , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com, Eric Anholt , Stefan Wahren Subject: [PATCH] hwrng: bcm2835 - fix probe as platform device Date: Tue, 19 Feb 2019 13:16:08 +0100 Message-Id: <20190219121608.19406-1-jonas.gorski@gmail.com> X-Mailer: git-send-email 2.13.2 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org BCM63XX (MIPS) does not use device tree, so there cannot be any of_device_id, causing the driver to fail on probe: [ 0.904564] bcm2835-rng: probe of bcm63xx-rng failed with error -22 Fix this by checking for match data only if we are probing from device tree. Fixes: 8705f24f7b57 ("hwrng: bcm2835 - Enable BCM2835 RNG to work on BCM63xx platforms") Signed-off-by: Jonas Gorski --- drivers/char/hw_random/bcm2835-rng.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c index 256b0b1d0f26..f759790c3cdb 100644 --- a/drivers/char/hw_random/bcm2835-rng.c +++ b/drivers/char/hw_random/bcm2835-rng.c @@ -168,14 +168,16 @@ static int bcm2835_rng_probe(struct platform_device *pdev) priv->rng.read = bcm2835_rng_read; priv->rng.cleanup = bcm2835_rng_cleanup; - rng_id = of_match_node(bcm2835_rng_of_match, np); - if (!rng_id) - return -EINVAL; - - /* Check for rng init function, execute it */ - of_data = rng_id->data; - if (of_data) - priv->mask_interrupts = of_data->mask_interrupts; + if (dev_of_node(dev)) { + rng_id = of_match_node(bcm2835_rng_of_match, np); + if (!rng_id) + return -EINVAL; + + /* Check for rng init function, execute it */ + of_data = rng_id->data; + if (of_data) + priv->mask_interrupts = of_data->mask_interrupts; + } /* register driver */ err = devm_hwrng_register(dev, &priv->rng); -- 2.13.2