FDT.pm: consistently check defined()

In a few cases, we check not $var to check if a var has a defined value.
This also catches the case where $var has a defined value, but evaluates
to false (e.g. if $var is zero).

In FDT::Node::get_translated_reg(), this erroneous check means that reg
entries with an address zero will not be translated, even where there is
a valid set of ranges properties in parent nodes.

Elsewhere, this is simply inconsistent, but not otherwise harmful.

Fix the code to use defined($var) consistently.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reported-by: Vladimir Murzin <vladimir.murzin@arm.com>
Tested-by: Vladimir Murzin <vladimir.murzin@arm.com>
diff --git a/FDT.pm b/FDT.pm
index 2315e2d..b814ef8 100755
--- a/FDT.pm
+++ b/FDT.pm
@@ -211,7 +211,7 @@
 	for (;;) {
 		$child = FDT::Node->parse($fh, $header, $self);
-		last if (not $child);
+		last if (not defined($child));
 		push (@children, $child);
@@ -310,7 +310,7 @@
 	my $parent = $self->{parent};
 	# root node require no translation
-	return $addr if (not $parent);
+	return $addr if (not defined($parent));
 	my $ranges = $self->get_property("ranges");
 	if (not defined($ranges)) {
@@ -364,7 +364,7 @@
 	my ($addr, $size) = $reg->read_cell_list($off, [$ac, $sc]);
 	for (my $parent = $self->{parent}; $parent; $parent = $parent->{parent}) {
-		last if (not $addr);
+		last if (not defined($addr));
 		$addr = $parent->translate_address($addr);
@@ -394,7 +394,7 @@
 	if ($len != 0) {
 		$self->{data} = FDT::read_padded_data($fh, $len);
-	goto failed if ($len and not $self->{data});
+	goto failed if ($len and not defined($self->{data}));
 	$self->{len} = $len;