From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [kvm-unit-tests PATCH v2 3/4] devicetree: remove unused globals Date: Wed, 11 May 2016 17:46:30 +0200 Message-ID: <573353D6.6090105@redhat.com> References: <1462973121-14548-1-git-send-email-drjones@redhat.com> <1462973121-14548-4-git-send-email-drjones@redhat.com> <573351F5.4010202@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: lvivier@redhat.com To: Thomas Huth , Andrew Jones , kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:39488 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932100AbcEKPqf (ORCPT ); Wed, 11 May 2016 11:46:35 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CD3AD21487 for ; Wed, 11 May 2016 15:46:34 +0000 (UTC) In-Reply-To: <573351F5.4010202@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 11/05/2016 17:38, Thomas Huth wrote: > On 11.05.2016 15:25, Andrew Jones wrote: >> root_nr_address_cells and root_nr_size_cells are unused, >> thanks to the last two patches. Remove them, and tidy-up >> dt_init while at it. >> >> Signed-off-by: Andrew Jones >> --- >> lib/devicetree.c | 12 +++--------- >> 1 file changed, 3 insertions(+), 9 deletions(-) >> >> diff --git a/lib/devicetree.c b/lib/devicetree.c >> index 2da7d22339a64..c091459a94e27 100644 >> --- a/lib/devicetree.c >> +++ b/lib/devicetree.c >> @@ -8,7 +8,6 @@ >> #include "devicetree.h" >> >> static const void *fdt; >> -static u32 root_nr_address_cells, root_nr_size_cells; >> >> const void *dt_fdt(void) >> { >> @@ -278,21 +277,16 @@ int dt_get_default_console_node(void) >> >> int dt_init(const void *fdt_ptr) >> { >> - int root, ret; >> + int ret; >> >> ret = fdt_check_header(fdt_ptr); >> if (ret < 0) >> return ret; >> - fdt = fdt_ptr; >> - >> - root = fdt_path_offset(fdt, "/"); >> - if (root < 0) >> - return root; >> >> - ret = dt_get_nr_cells(root, &root_nr_address_cells, >> - &root_nr_size_cells); >> + ret = fdt_path_offset(fdt_ptr, "/"); > > That line is now only a sanity check, right? ... in case you respin, you > could maybe add a comment here what this is good for. I can do that like this: diff --git a/lib/devicetree.c b/lib/devicetree.c index c091459..b9f1d3d 100644 --- a/lib/devicetree.c +++ b/lib/devicetree.c @@ -283,6 +283,7 @@ int dt_init(const void *fdt_ptr) if (ret < 0) return ret; + /* Sanity check the path. */ ret = fdt_path_offset(fdt_ptr, "/"); if (ret < 0) return ret; Andrew, is this okay? Thanks, Paolo