in hwspinlock_core.c [612:633]
int devm_hwspin_lock_register(struct device *dev,
struct hwspinlock_device *bank,
const struct hwspinlock_ops *ops,
int base_id, int num_locks)
{
struct hwspinlock_device **ptr;
int ret;
ptr = devres_alloc(devm_hwspin_lock_unreg, sizeof(*ptr), GFP_KERNEL);
if (!ptr)
return -ENOMEM;
ret = hwspin_lock_register(bank, dev, ops, base_id, num_locks);
if (!ret) {
*ptr = bank;
devres_add(dev, ptr);
} else {
devres_free(ptr);
}
return ret;
}