summaryrefslogtreecommitdiff
path: root/drivers/crypto/nx
diff options
context:
space:
mode:
authorLiang He <windhl@126.com>2022-06-30 11:36:57 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2022-07-08 10:21:16 +0300
commit8ccc9cc47c8c9e69c7bd9a7694a1d8c33108dd28 (patch)
treee4a0e90b564f04275c6bd4eb775bcaf5c0570bad /drivers/crypto/nx
parent9984a6447389a01cc5e8501b2ead3024b2d99c19 (diff)
downloadlinux-8ccc9cc47c8c9e69c7bd9a7694a1d8c33108dd28.tar.xz
crypto: nx - Hold the reference returned by of_find_compatible_node
In nx842_pseries_init(), we should hold the reference returned by of_find_compatible_node() and use it to call of_node_put to keep refcount balance. Signed-off-by: Liang He <windhl@126.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/nx')
-rw-r--r--drivers/crypto/nx/nx-common-pseries.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/crypto/nx/nx-common-pseries.c b/drivers/crypto/nx/nx-common-pseries.c
index 7584a34ba88c..3ea334b7f820 100644
--- a/drivers/crypto/nx/nx-common-pseries.c
+++ b/drivers/crypto/nx/nx-common-pseries.c
@@ -1208,10 +1208,13 @@ static struct vio_driver nx842_vio_driver = {
static int __init nx842_pseries_init(void)
{
struct nx842_devdata *new_devdata;
+ struct device_node *np;
int ret;
- if (!of_find_compatible_node(NULL, NULL, "ibm,compression"))
+ np = of_find_compatible_node(NULL, NULL, "ibm,compression");
+ if (!np)
return -ENODEV;
+ of_node_put(np);
RCU_INIT_POINTER(devdata, NULL);
new_devdata = kzalloc(sizeof(*new_devdata), GFP_KERNEL);