Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1acce5f7 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

media: v4l2-fwnode: use the cached value instead of getting again



There is a get/put operation in order to get firmware is_available
data there at the __v4l2_async_notifier_parse_fwnode_endpoints()
function. However, instead of using it, the code just reads again
without the lock. That's a bug, as dev_fwnode isn't guaranteed
to be there once fwnode_handle_put() has been called on it.

This solves this smatch warning:

drivers/media/v4l2-core/v4l2-fwnode.c:453:8: warning: variable 'is_available' set but not used [-Wunused-but-set-variable]
   bool is_available;
        ^~~~~~~~~~~~

Fixes: 9ca46531 ("media: v4l: fwnode: Support generic parsing of graph endpoints in a device")
Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent ceb3c45b
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -455,8 +455,7 @@ static int __v4l2_async_notifier_parse_fwnode_endpoints(
		dev_fwnode = fwnode_graph_get_port_parent(fwnode);
		is_available = fwnode_device_is_available(dev_fwnode);
		fwnode_handle_put(dev_fwnode);

		if (!fwnode_device_is_available(dev_fwnode))
		if (!is_available)
			continue;

		if (WARN_ON(notifier->num_subdevs >= notifier->max_subdevs)) {