summaryrefslogtreecommitdiffstats
path: root/drivers/base/property.c
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>2015-12-29 06:07:49 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-12-31 20:09:51 -0500
commit0fb5902f2f9ec7996a0846087f3e69165ea9ce1e (patch)
treeab74e513b1dedaee2f14abb941e79b64ee719bfc /drivers/base/property.c
parentaace7367bf83aef7baa021c7bcc9d2e331b040aa (diff)
device property: the secondary fwnode needs to depend on the primary
This fixes NULL pointer dereference when the primary fwnode handle does not exist, for example with PCI devices that do not have ACPI companion. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base/property.c')
-rw-r--r--drivers/base/property.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/base/property.c b/drivers/base/property.c
index 0b22c8a5b5db..b3429cc4ee63 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -218,7 +218,7 @@ bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname)
218 bool ret; 218 bool ret;
219 219
220 ret = __fwnode_property_present(fwnode, propname); 220 ret = __fwnode_property_present(fwnode, propname);
221 if (ret == false && fwnode->secondary) 221 if (ret == false && fwnode && fwnode->secondary)
222 ret = __fwnode_property_present(fwnode->secondary, propname); 222 ret = __fwnode_property_present(fwnode->secondary, propname);
223 return ret; 223 return ret;
224} 224}
@@ -423,7 +423,7 @@ EXPORT_SYMBOL_GPL(device_property_match_string);
423 int _ret_; \ 423 int _ret_; \
424 _ret_ = FWNODE_PROP_READ(_fwnode_, _propname_, _type_, _proptype_, \ 424 _ret_ = FWNODE_PROP_READ(_fwnode_, _propname_, _type_, _proptype_, \
425 _val_, _nval_); \ 425 _val_, _nval_); \
426 if (_ret_ == -EINVAL && _fwnode_->secondary) \ 426 if (_ret_ == -EINVAL && _fwnode_ && _fwnode_->secondary) \
427 _ret_ = FWNODE_PROP_READ(_fwnode_->secondary, _propname_, _type_, \ 427 _ret_ = FWNODE_PROP_READ(_fwnode_->secondary, _propname_, _type_, \
428 _proptype_, _val_, _nval_); \ 428 _proptype_, _val_, _nval_); \
429 _ret_; \ 429 _ret_; \
@@ -593,7 +593,7 @@ int fwnode_property_read_string_array(struct fwnode_handle *fwnode,
593 int ret; 593 int ret;
594 594
595 ret = __fwnode_property_read_string_array(fwnode, propname, val, nval); 595 ret = __fwnode_property_read_string_array(fwnode, propname, val, nval);
596 if (ret == -EINVAL && fwnode->secondary) 596 if (ret == -EINVAL && fwnode && fwnode->secondary)
597 ret = __fwnode_property_read_string_array(fwnode->secondary, 597 ret = __fwnode_property_read_string_array(fwnode->secondary,
598 propname, val, nval); 598 propname, val, nval);
599 return ret; 599 return ret;
@@ -621,7 +621,7 @@ int fwnode_property_read_string(struct fwnode_handle *fwnode,
621 int ret; 621 int ret;
622 622
623 ret = __fwnode_property_read_string(fwnode, propname, val); 623 ret = __fwnode_property_read_string(fwnode, propname, val);
624 if (ret == -EINVAL && fwnode->secondary) 624 if (ret == -EINVAL && fwnode && fwnode->secondary)
625 ret = __fwnode_property_read_string(fwnode->secondary, 625 ret = __fwnode_property_read_string(fwnode->secondary,
626 propname, val); 626 propname, val);
627 return ret; 627 return ret;