Commit b6a11a7f authored by Arkadiusz Kubalewski's avatar Arkadiusz Kubalewski Committed by David S. Miller

dpll: fix broken error path in dpll_pin_alloc(..)

If pin type is not expected, or pin properities failed to allocate
memory, the unwind error path shall not destroy pin's xarrays, which
were not yet initialized.
Add new goto label and use it to fix broken error path.
Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
Signed-off-by: default avatarArkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ef485216
...@@ -441,7 +441,7 @@ dpll_pin_alloc(u64 clock_id, u32 pin_idx, struct module *module, ...@@ -441,7 +441,7 @@ dpll_pin_alloc(u64 clock_id, u32 pin_idx, struct module *module,
if (WARN_ON(prop->type < DPLL_PIN_TYPE_MUX || if (WARN_ON(prop->type < DPLL_PIN_TYPE_MUX ||
prop->type > DPLL_PIN_TYPE_MAX)) { prop->type > DPLL_PIN_TYPE_MAX)) {
ret = -EINVAL; ret = -EINVAL;
goto err; goto err_pin_prop;
} }
pin->prop = prop; pin->prop = prop;
refcount_set(&pin->refcount, 1); refcount_set(&pin->refcount, 1);
...@@ -450,11 +450,12 @@ dpll_pin_alloc(u64 clock_id, u32 pin_idx, struct module *module, ...@@ -450,11 +450,12 @@ dpll_pin_alloc(u64 clock_id, u32 pin_idx, struct module *module,
ret = xa_alloc_cyclic(&dpll_pin_xa, &pin->id, pin, xa_limit_32b, ret = xa_alloc_cyclic(&dpll_pin_xa, &pin->id, pin, xa_limit_32b,
&dpll_pin_xa_id, GFP_KERNEL); &dpll_pin_xa_id, GFP_KERNEL);
if (ret) if (ret)
goto err; goto err_xa_alloc;
return pin; return pin;
err: err_xa_alloc:
xa_destroy(&pin->dpll_refs); xa_destroy(&pin->dpll_refs);
xa_destroy(&pin->parent_refs); xa_destroy(&pin->parent_refs);
err_pin_prop:
kfree(pin); kfree(pin);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment