[{"id":1798126,"web_url":"http://patchwork.ozlabs.org/comment/1798126/","msgid":"<1668125.RyNuczo2n4@avalon>","list_archive_url":null,"date":"2017-11-02T17:37:15","subject":"Re: [RESEND PATCH 1/1] of: Make return types of to_of_node and\n\tof_fwnode_handle macros consistent","submitter":{"id":11034,"url":"http://patchwork.ozlabs.org/api/people/11034/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Sakari,\n\nThank you for the patch.\n\nOn Thursday, 2 November 2017 11:59:18 EET Sakari Ailus wrote:\n> (Fixed Mauro's e-mail.)\n> \n> to_of_node() macro checks whether the fwnode_handle passed to it is not an\n> OF node, and if so, returns NULL in order to be NULL-safe. Otherwise it\n> returns the pointer to the OF node which the fwnode_handle contains.\n> \n> The problem with returning NULL is that its type was void *, which\n> sometimes matters. Explicitly return struct device_node * instead.\n> \n> Make a similar change to of_fwnode_handle() as well.\n> \n> Fixes: d20dc1493db4 (\"of: Support const and non-const use for to_of_node()\")\n> Fixes: debd3a3b27c7 (\"of: Make of_fwnode_handle() safer\")\n> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n> Hi Mauro,\n> \n> Could you check whether this addresses the smatch issue with the xilinx\n> driver?\n> \n> Thanks.\n> \n>  include/linux/of.h | 5 +++--\n>  1 file changed, 3 insertions(+), 2 deletions(-)\n> \n> diff --git a/include/linux/of.h b/include/linux/of.h\n> index b240ed69dc96..0651231c115e 100644\n> --- a/include/linux/of.h\n> +++ b/include/linux/of.h\n> @@ -161,7 +161,7 @@ static inline bool is_of_node(const struct fwnode_handle\n> *fwnode) is_of_node(__to_of_node_fwnode) ?\t\t\t\\\n>  \t\t\tcontainer_of(__to_of_node_fwnode,\t\t\\\n>  \t\t\t\t     struct device_node, fwnode) :\t\\\n> -\t\t\tNULL;\t\t\t\t\t\t\\\n> +\t\t\t(struct device_node *)NULL;\t\t\t\\\n>  \t})\n> \n>  #define of_fwnode_handle(node)\t\t\t\t\t\t\\\n> @@ -169,7 +169,8 @@ static inline bool is_of_node(const struct fwnode_handle\n> *fwnode) typeof(node) __of_fwnode_handle_node = (node);\t\t\\\n>  \t\t\t\t\t\t\t\t\t\\\n>  \t\t__of_fwnode_handle_node ?\t\t\t\t\\\n> -\t\t\t&__of_fwnode_handle_node->fwnode : NULL;\t\\\n> +\t\t\t&__of_fwnode_handle_node->fwnode :\t\t\\\n> +\t\t\t(struct fwnode_handle *)NULL;\t\t\t\\\n>  \t})\n> \n>  static inline bool of_have_populated_dt(void)","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"M4DjEIF2\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3ySXMz6g2qz9sBW\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tFri,  3 Nov 2017 04:37:19 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S932208AbdKBRhR (ORCPT <rfc822; incoming-dt@patchwork.ozlabs.org>);\n\tThu, 2 Nov 2017 13:37:17 -0400","from galahad.ideasonboard.com ([185.26.127.97]:40325 \"EHLO\n\tgalahad.ideasonboard.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1752304AbdKBRhQ (ORCPT\n\t<rfc822; devicetree@vger.kernel.org>); Thu, 2 Nov 2017 13:37:16 -0400","from avalon.localnet (unknown [49.229.89.25])\n\tby galahad.ideasonboard.com (Postfix) with ESMTPSA id 658CF20218;\n\tThu,  2 Nov 2017 18:36:15 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1509644175;\n\tbh=hu+FPxrXLbRo1dFsBesSwPIhgRcNXaP4CLK5D6QiSb8=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=M4DjEIF2tFWD3YFHdBwlBEqxnwqnsFMDrlbQ86ECpqadCskY5k0pkKo2wC6p4EpSw\n\tbuiW0WCA2LOo80gzzZ0qxwSUFNyqlm84MTsxvUqrfaqVLS799hhP0c3N5zBYOwtSQR\n\t7gWWseRhaWhDj40/K3BdRiN/KUT5zW5zvS7MApsM=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Sakari Ailus <sakari.ailus@linux.intel.com>","Cc":"devicetree@vger.kernel.org, mchehab@s-opensource.com,\n\tlinux-media@vger.kernel.org, robh@kernel.org, hyun.kwon@xilinx.com,\n\tsoren.brinkmann@xilinx.com, linux-arm-kernel@lists.infradead.org","Subject":"Re: [RESEND PATCH 1/1] of: Make return types of to_of_node and\n\tof_fwnode_handle macros consistent","Date":"Thu, 02 Nov 2017 19:37:15 +0200","Message-ID":"<1668125.RyNuczo2n4@avalon>","In-Reply-To":"<20171102095918.7041-1-sakari.ailus@linux.intel.com>","References":"<2117711.dO2rQLXOup@avalon>\n\t<20171102095918.7041-1-sakari.ailus@linux.intel.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"7Bit","Content-Type":"text/plain; charset=\"us-ascii\"","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}},{"id":1800023,"web_url":"http://patchwork.ozlabs.org/comment/1800023/","msgid":"<20171106214546.br4excrvclrxfd7f@rob-hp-laptop>","list_archive_url":null,"date":"2017-11-06T21:45:46","subject":"Re: [RESEND PATCH 1/1] of: Make return types of to_of_node and\n\tof_fwnode_handle macros consistent","submitter":{"id":62529,"url":"http://patchwork.ozlabs.org/api/people/62529/","name":"Rob Herring (Arm)","email":"robh@kernel.org"},"content":"On Thu, Nov 02, 2017 at 11:59:18AM +0200, Sakari Ailus wrote:\n> (Fixed Mauro's e-mail.)\n> \n> to_of_node() macro checks whether the fwnode_handle passed to it is not an\n> OF node, and if so, returns NULL in order to be NULL-safe. Otherwise it\n> returns the pointer to the OF node which the fwnode_handle contains.\n> \n> The problem with returning NULL is that its type was void *, which\n> sometimes matters. Explicitly return struct device_node * instead.\n> \n> Make a similar change to of_fwnode_handle() as well.\n> \n> Fixes: d20dc1493db4 (\"of: Support const and non-const use for to_of_node()\")\n> Fixes: debd3a3b27c7 (\"of: Make of_fwnode_handle() safer\")\n> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>\n> ---\n> Hi Mauro,\n> \n> Could you check whether this addresses the smatch issue with the xilinx\n> driver?\n> \n> Thanks.\n> \n>  include/linux/of.h | 5 +++--\n>  1 file changed, 3 insertions(+), 2 deletions(-)\n\nAcked-by: Rob Herring <robh@kernel.org>\n--\nTo unsubscribe from this list: send the line \"unsubscribe devicetree\" in\nthe body of a message to majordomo@vger.kernel.org\nMore majordomo info at  http://vger.kernel.org/majordomo-info.html","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3yW5ht3s9sz9ryv\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tTue,  7 Nov 2017 08:45:50 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752589AbdKFVps (ORCPT\n\t<rfc822;incoming-dt@patchwork.ozlabs.org>);\n\tMon, 6 Nov 2017 16:45:48 -0500","from mail-oi0-f48.google.com ([209.85.218.48]:52659 \"EHLO\n\tmail-oi0-f48.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751712AbdKFVps (ORCPT\n\t<rfc822; devicetree@vger.kernel.org>); Mon, 6 Nov 2017 16:45:48 -0500","by mail-oi0-f48.google.com with SMTP id r128so8672028oig.9;\n\tMon, 06 Nov 2017 13:45:48 -0800 (PST)","from localhost (216-188-254-6.dyn.grandenetworks.net.\n\t[216.188.254.6]) by smtp.gmail.com with ESMTPSA id\n\th7sm6325050oti.76.2017.11.06.13.45.46\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tMon, 06 Nov 2017 13:45:46 -0800 (PST)"],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:in-reply-to:user-agent;\n\tbh=612zq8pjD8dbGlrmzXlaVjmqBHOkfi8XtP0EJcOonH8=;\n\tb=fkEdj+ouE+DQS7w664WqkYviNByO7Il0cbATPd/ZdPpXAzqfmgTEGn+QIsmBCtbBpZ\n\tbI8s6XhopyXpRrtYBvXbS6YGKEic8jI3M/26/I5v/pHUFRv3EJYPMlWvNrlKsyekBKyP\n\tX3dWZS2+l/GHP/JVFcPPBzLq3k7bkLjQzz1aPsFxfmQsNFCyyk5YcT8GBtVhzc25HkH/\n\twsA0lyHkMjT1ydo/LkiqidbI8QxtbcsJ1ACzNN69NNXv2Wc0KxPCmsco9gfMH+pVBmHb\n\toJ1uumfX8qiNc/oeYGj0ddIJFbEIggMqT/R6B9w+EQdH1R1Rcf0qXOi008z06bbJZRP0\n\tN5iA==","X-Gm-Message-State":"AMCzsaWmvCC7bhNJVR8QzBnifUlA6VNbZ909P+OKoynXFvUfRQhsgtgt\n\t0RoDYDtnf21Ja9JjcvvIWV8RX+s=","X-Google-Smtp-Source":"ABhQp+Tp1bZ9ILmW1in2gsbyHKVFEi9I2BVsE7CyisRLeAEpde1LuzAOq/caBz4xMTjfqonwd78i0g==","X-Received":"by 10.202.75.207 with SMTP id y198mr9334877oia.204.1510004747546;\n\tMon, 06 Nov 2017 13:45:47 -0800 (PST)","Date":"Mon, 6 Nov 2017 15:45:46 -0600","From":"Rob Herring <robh@kernel.org>","To":"Sakari Ailus <sakari.ailus@linux.intel.com>","Cc":"devicetree@vger.kernel.org, mchehab@s-opensource.com,\n\tlinux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com,\n\thyun.kwon@xilinx.com, soren.brinkmann@xilinx.com,\n\tlinux-arm-kernel@lists.infradead.org","Subject":"Re: [RESEND PATCH 1/1] of: Make return types of to_of_node and\n\tof_fwnode_handle macros consistent","Message-ID":"<20171106214546.br4excrvclrxfd7f@rob-hp-laptop>","References":"<2117711.dO2rQLXOup@avalon>\n\t<20171102095918.7041-1-sakari.ailus@linux.intel.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20171102095918.7041-1-sakari.ailus@linux.intel.com>","User-Agent":"NeoMutt/20170609 (1.8.3)","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}}]