Commit 7d2da603 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

nfp: fix nfp_cpp_read()/nfp_cpp_write() error paths

When acquiring an area fails we can't call function doing both
release and free.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1bb665e3
......@@ -951,12 +951,14 @@ int nfp_cpp_read(struct nfp_cpp *cpp, u32 destination,
return -ENOMEM;
err = nfp_cpp_area_acquire(area);
if (err)
goto out;
if (err) {
nfp_cpp_area_free(area);
return err;
}
}
err = nfp_cpp_area_read(area, offset, kernel_vaddr, length);
out:
if (cache)
area_cache_put(cpp, cache);
else
......@@ -993,13 +995,14 @@ int nfp_cpp_write(struct nfp_cpp *cpp, u32 destination,
return -ENOMEM;
err = nfp_cpp_area_acquire(area);
if (err)
goto out;
if (err) {
nfp_cpp_area_free(area);
return err;
}
}
err = nfp_cpp_area_write(area, offset, kernel_vaddr, length);
out:
if (cache)
area_cache_put(cpp, cache);
else
......
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