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: 10038265 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 8858B6032D for ; Thu, 2 Nov 2017 09:59:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77D0A28ED7 for ; Thu, 2 Nov 2017 09:59:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B9C828ED9; Thu, 2 Nov 2017 09:59:23 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 002C128ED8 for ; Thu, 2 Nov 2017 09:59:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754785AbdKBJ7V (ORCPT ); Thu, 2 Nov 2017 05:59:21 -0400 Received: from nblzone-211-213.nblnetworks.fi ([83.145.211.213]:52592 "EHLO hillosipuli.retiisi.org.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752237AbdKBJ7U (ORCPT ); Thu, 2 Nov 2017 05:59:20 -0400 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 Cc: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com, robh@kernel.org, hyun.kwon@xilinx.com, soren.brinkmann@xilinx.com, linux-arm-kernel@lists.infradead.org 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> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.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)