Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753947AbbKXKXI (ORCPT ); Tue, 24 Nov 2015 05:23:08 -0500 Received: from mga01.intel.com ([192.55.52.88]:56574 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752712AbbKXKXE (ORCPT ); Tue, 24 Nov 2015 05:23:04 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,338,1444719600"; d="scan'208";a="858586634" From: Andy Shevchenko To: "Rafael J. Wysocki" , Greg Kroah-Hartman , Jarkko Nikula , linux-i2c@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, Lee Jones , Mika Westerberg , Kevin Fenzi , Arnd Bergmann , Wolfram Sang Cc: Andy Shevchenko Subject: [PATCH v1 01/13] device property: always check for fwnode type Date: Tue, 24 Nov 2015 12:22:47 +0200 Message-Id: <1448360579-79260-2-git-send-email-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1448360579-79260-1-git-send-email-andriy.shevchenko@linux.intel.com> References: <1448360579-79260-1-git-send-email-andriy.shevchenko@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1821 Lines: 50 Currently the property accessors unconditionally fall back to built-in property set as a last resort. Make this strict and return an error in case the type of fwnode is unknown. This is actually a follow up to the commit 4fa7508e9f1c (device property: Return -ENXIO if there is no suitable FW interface). Signed-off-by: Andy Shevchenko --- drivers/base/property.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/base/property.c b/drivers/base/property.c index 1325ff2..09e488d 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -135,8 +135,9 @@ bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname) return of_property_read_bool(to_of_node(fwnode), propname); else if (is_acpi_node(fwnode)) return !acpi_node_prop_get(fwnode, propname, NULL); - - return !!pset_prop_get(to_pset(fwnode), propname); + else if (is_pset(fwnode)) + return !!pset_prop_get(to_pset(fwnode), propname); + return false; } EXPORT_SYMBOL_GPL(fwnode_property_present); @@ -494,9 +495,10 @@ int fwnode_property_read_string(struct fwnode_handle *fwnode, else if (is_acpi_node(fwnode)) return acpi_node_prop_read(fwnode, propname, DEV_PROP_STRING, val, 1); - - return pset_prop_read_array(to_pset(fwnode), propname, - DEV_PROP_STRING, val, 1); + else if (is_pset(fwnode)) + return pset_prop_read_array(to_pset(fwnode), propname, + DEV_PROP_STRING, val, 1); + return -ENXIO; } EXPORT_SYMBOL_GPL(fwnode_property_read_string); -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/