Message ID | d4e3550f-3c50-41f8-a6ed-dd689b2ae868@web.de (mailing list archive) |
---|---|
State | Rejected, archived |
Delegated to: | Ira Weiny |
Headers | show |
Series | nvdimm: Call nvdimm_put_key(key) only once in nvdimm_key_revalidate() | expand |
diff --git a/drivers/nvdimm/security.c b/drivers/nvdimm/security.c index a03e3c45f297..83c30980307c 100644 --- a/drivers/nvdimm/security.c +++ b/drivers/nvdimm/security.c @@ -152,12 +152,10 @@ static int nvdimm_key_revalidate(struct nvdimm *nvdimm) * verify that the key is good. */ rc = nvdimm->sec.ops->change_key(nvdimm, data, data, NVDIMM_USER); - if (rc < 0) { - nvdimm_put_key(key); + nvdimm_put_key(key); + if (rc < 0) return rc; - } - nvdimm_put_key(key); nvdimm->sec.flags = nvdimm_security_flags(nvdimm, NVDIMM_USER); return 0; }