From patchwork Thu Nov 2 09:59:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 10038269 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CDE5C6032D for ; Thu, 2 Nov 2017 09:59:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD2D02857E for ; Thu, 2 Nov 2017 09:59:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1BEF285F5; Thu, 2 Nov 2017 09:59:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 42E472857E for ; Thu, 2 Nov 2017 09:59:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=9L8PWDiVFlr9ukg59Wig8EySqyBzUiNe8SyqUP7xHL8=; b=QaYrjvjJanMUR7JnywJJ5JJbop BqJd5xnO9DtqRo58n7FG9Y7pQKvdCLrLdOeUYlkrHfvwHum4TND89s3Mp/ZNC/+36rz7eymSqAhpL jmFWVigag+PYoc2TCicoRZzeasNlPbwFqIJhEaxWsvU/6OeabIhMDEfai1Nsml/Mc2nBI3P3VMmrm apBMAoD3hMxTGBalALOaFZObLhNKGztaZqefsC/Rtcdb/8OVKrGOvn1lCVNGSq0Lki9V/ZhAANCD8 H5YuaPNjz1BBT3RKwg+Xliik/YVGAH2GeQLkznpSCpx9QzBzckJzee4qwKzf0Y6eBtwdIkiXfXiRb /xXz288w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eACHp-0005Km-Gj; Thu, 02 Nov 2017 09:59:45 +0000 Received: from hillosipuli.retiisi.org.uk ([2001:1bc8:1a6:d3d5::81:2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eACHk-0005El-JT for linux-arm-kernel@lists.infradead.org; Thu, 02 Nov 2017 09:59:42 +0000 Received: from lanttu.localdomain (unknown [IPv6:2001:1bc8:1a6:d3d5::e1:1002]) by hillosipuli.retiisi.org.uk (Postfix) with ESMTP id C80F1600E4; Thu, 2 Nov 2017 11:59:18 +0200 (EET) From: Sakari Ailus To: devicetree@vger.kernel.org, mchehab@s-opensource.com Subject: [RESEND PATCH 1/1] of: Make return types of to_of_node and of_fwnode_handle macros consistent Date: Thu, 2 Nov 2017 11:59:18 +0200 Message-Id: <20171102095918.7041-1-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <2117711.dO2rQLXOup@avalon> References: <2117711.dO2rQLXOup@avalon> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171102_025940_938801_84635B4E X-CRM114-Status: UNSURE ( 8.29 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robh@kernel.org, hyun.kwon@xilinx.com, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, soren.brinkmann@xilinx.com, laurent.pinchart@ideasonboard.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP (Fixed Mauro's e-mail.) to_of_node() macro checks whether the fwnode_handle passed to it is not an OF node, and if so, returns NULL in order to be NULL-safe. Otherwise it returns the pointer to the OF node which the fwnode_handle contains. The problem with returning NULL is that its type was void *, which sometimes matters. Explicitly return struct device_node * instead. Make a similar change to of_fwnode_handle() as well. Fixes: d20dc1493db4 ("of: Support const and non-const use for to_of_node()") Fixes: debd3a3b27c7 ("of: Make of_fwnode_handle() safer") Signed-off-by: Sakari Ailus Reviewed-by: Laurent Pinchart Acked-by: Rob Herring --- Hi Mauro, Could you check whether this addresses the smatch issue with the xilinx driver? Thanks. include/linux/of.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/linux/of.h b/include/linux/of.h index b240ed69dc96..0651231c115e 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -161,7 +161,7 @@ static inline bool is_of_node(const struct fwnode_handle *fwnode) is_of_node(__to_of_node_fwnode) ? \ container_of(__to_of_node_fwnode, \ struct device_node, fwnode) : \ - NULL; \ + (struct device_node *)NULL; \ }) #define of_fwnode_handle(node) \ @@ -169,7 +169,8 @@ static inline bool is_of_node(const struct fwnode_handle *fwnode) typeof(node) __of_fwnode_handle_node = (node); \ \ __of_fwnode_handle_node ? \ - &__of_fwnode_handle_node->fwnode : NULL; \ + &__of_fwnode_handle_node->fwnode : \ + (struct fwnode_handle *)NULL; \ }) static inline bool of_have_populated_dt(void)