if (!val)
return -EINVAL;
- mutex_lock(&cdx_controller_lock);
+ guard(mutex)(&cdx_controller_lock);
/* Unregister all the devices on the bus */
cdx_unregister_devices(&cdx_bus_type);
/* Rescan all the devices */
for_each_compatible_node_scoped(np, NULL, compat_node_name) {
pd = of_find_device_by_node(np);
- if (!pd) {
- count = -EINVAL;
- goto unlock;
- }
+ if (!pd)
+ return -EINVAL;
cdx = platform_get_drvdata(pd);
if (cdx && cdx->controller_registered && cdx->ops->scan)
put_device(&pd->dev);
}
-unlock:
- mutex_unlock(&cdx_controller_lock);
-
return count;
}
static BUS_ATTR_WO(rescan);