diff options
author | Andy Shevchenko <[email protected]> | 2022-04-08 21:48:40 +0300 |
---|---|---|
committer | Rafael J. Wysocki <[email protected]> | 2022-04-13 20:04:02 +0200 |
commit | 002752af7b89b74c64fe6bec8c5fde3d3a7810d8 (patch) | |
tree | 68a6816d0421e36c4c02ee9b842ed5b363302b2c /lib/mpi/mpi-sub-ui.c | |
parent | 3bd561e1572ee02a50cd1a5be339abf1a5b78d56 (diff) |
device property: Allow error pointer to be passed to fwnode APIs
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: 83b34afb6b79 ("device property: Introduce fwnode_find_reference()")
Reported-by: Nuno Sá <[email protected]>
Tested-by: Nuno Sá <[email protected]>
Acked-by: Nuno Sá <[email protected]>
Reviewed-by: Sakari Ailus <[email protected]>
Reviewed-by: Heikki Krogerus <[email protected]>
Signed-off-by: Andy Shevchenko <[email protected]>
Tested-by: Michael Walle <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
Diffstat (limited to 'lib/mpi/mpi-sub-ui.c')
0 files changed, 0 insertions, 0 deletions