From: Liang He Date: Thu, 30 Jun 2022 08:36:57 +0000 (+0800) Subject: crypto: nx - Hold the reference returned by of_find_compatible_node X-Git-Tag: v6.6.17~6939^2~41 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8ccc9cc47c8c9e69c7bd9a7694a1d8c33108dd28;p=platform%2Fkernel%2Flinux-rpi.git 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 Signed-off-by: Herbert Xu --- diff --git a/drivers/crypto/nx/nx-common-pseries.c b/drivers/crypto/nx/nx-common-pseries.c index 7584a34..3ea334b 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);