From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-bk0-x236.google.com ([2a00:1450:4008:c01::236]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uozju-0006ou-UW for barebox@lists.infradead.org; Tue, 18 Jun 2013 17:30:43 +0000 Received: by mail-bk0-f54.google.com with SMTP id it16so1926204bkc.13 for ; Tue, 18 Jun 2013 10:30:20 -0700 (PDT) From: Sebastian Hesselbarth Date: Tue, 18 Jun 2013 19:29:47 +0200 Message-Id: <1371576607-8090-3-git-send-email-sebastian.hesselbarth@gmail.com> In-Reply-To: <1371576607-8090-1-git-send-email-sebastian.hesselbarth@gmail.com> References: <1371576607-8090-1-git-send-email-sebastian.hesselbarth@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 02/22] OF: base: bail out early on missing matches for of_match_node To: Sebastian Hesselbarth Cc: barebox@lists.infradead.org of_match_node checks for compatiblity between a set of matches and a node. Neither the matches nor node pointer are checked for validity. This adds the required checks to of_match_node. Signed-off-by: Sebastian Hesselbarth --- Cc: barebox@lists.infradead.org --- drivers/of/base.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 4241e65..ab0f4cd 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -321,6 +321,9 @@ EXPORT_SYMBOL(of_device_is_compatible); const struct of_device_id *of_match_node(const struct of_device_id *matches, const struct device_node *node) { + if (!matches || !node) + return NULL; + while (matches->compatible) { if (of_device_is_compatible(node, matches->compatible) == 1) return matches; -- 1.7.2.5 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox