-
由 Andy Shevchenko 提交于
Some of the fwnode APIs might return an error pointer instead of NULL or valid fwnode handle. The result of such API call may be considered optional and hence the test for it is usually done in a form of fwnode = fwnode_find_reference(...); if (IS_ERR(fwnode)) ...error handling... Nevertheless the resulting fwnode may have bumped the reference count and hence caller of the above API is obliged to call fwnode_handle_put(). Since fwnode may be not valid either as NULL or error pointer the check has to be performed there. This approach uglifies the code and adds a point of making a mistake, i.e. forgetting about error point case. To prevent this, allow an error pointer to be passed to the fwnode APIs. Fixes: 83b34afb ("device property: Introduce fwnode_find_reference()") Reported-by: NNuno Sá <nuno.sa@analog.com> Tested-by: NNuno Sá <nuno.sa@analog.com> Acked-by: NNuno Sá <nuno.sa@analog.com> Reviewed-by: NSakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: NHeikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Tested-by: NMichael Walle <michael@walle.cc> Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
002752af