In one of the error paths of the for_each_child_of_node() loop,
add missing call to of_node_put().
Fix the following coccicheck warning:
./drivers/crypto/nx/nx-common-powernv.c:927:1-23: WARNING: Function
"for_each_child_of_node" should have of_node_put() before return around
line 936.
Reported-by: Abaci Robot <[email protected]>
Signed-off-by: Yang Li <[email protected]>
---
drivers/crypto/nx/nx-common-powernv.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/crypto/nx/nx-common-powernv.c b/drivers/crypto/nx/nx-common-powernv.c
index 13c65de..b43c457 100644
--- a/drivers/crypto/nx/nx-common-powernv.c
+++ b/drivers/crypto/nx/nx-common-powernv.c
@@ -933,6 +933,7 @@ static int __init nx_powernv_probe_vas(struct device_node *pn)
NX_CT_GZIP, "ibm,p9-nx-gzip", &ct_gzip);
if (ret)
+ of_node_put(dn);
return ret;
}
--
1.8.3.1
Yang Li <[email protected]> writes:
> In one of the error paths of the for_each_child_of_node() loop,
> add missing call to of_node_put().
>
> Fix the following coccicheck warning:
> ./drivers/crypto/nx/nx-common-powernv.c:927:1-23: WARNING: Function
> "for_each_child_of_node" should have of_node_put() before return around
> line 936.
>
> Reported-by: Abaci Robot <[email protected]>
> Signed-off-by: Yang Li <[email protected]>
> ---
> drivers/crypto/nx/nx-common-powernv.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/crypto/nx/nx-common-powernv.c b/drivers/crypto/nx/nx-common-powernv.c
> index 13c65de..b43c457 100644
> --- a/drivers/crypto/nx/nx-common-powernv.c
> +++ b/drivers/crypto/nx/nx-common-powernv.c
> @@ -933,6 +933,7 @@ static int __init nx_powernv_probe_vas(struct device_node *pn)
> NX_CT_GZIP, "ibm,p9-nx-gzip", &ct_gzip);
>
> if (ret)
> + of_node_put(dn);
> return ret;
Sorry this is wrong, the if needs braces.
cheers
Hi Yang,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on powerpc/next]
[also build test WARNING on cryptodev/master crypto/master v5.11 next-20210225]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Yang-Li/crypto-nx-add-missing-call-to-of_node_put/20210225-165847
base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-ppc64_defconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/828d2f2854283776f81eabbdb8d2c93441206421
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Yang-Li/crypto-nx-add-missing-call-to-of_node_put/20210225-165847
git checkout 828d2f2854283776f81eabbdb8d2c93441206421
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
All warnings (new ones prefixed by >>):
drivers/crypto/nx/nx-common-powernv.c: In function 'nx_powernv_probe_vas':
>> drivers/crypto/nx/nx-common-powernv.c:935:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
935 | if (ret)
| ^~
drivers/crypto/nx/nx-common-powernv.c:937:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
937 | return ret;
| ^~~~~~
vim +/if +935 drivers/crypto/nx/nx-common-powernv.c
4aebf3ce26ca212 drivers/crypto/nx/nx-common-powernv.c Haren Myneni 2020-04-17 908
4aebf3ce26ca212 drivers/crypto/nx/nx-common-powernv.c Haren Myneni 2020-04-17 909 static int __init nx_powernv_probe_vas(struct device_node *pn)
b0d6c9bab5e41d0 drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2017-08-31 910 {
b0d6c9bab5e41d0 drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2017-08-31 911 int chip_id, vasid, ret = 0;
1af11ae225350a9 drivers/crypto/nx/nx-common-powernv.c Haren Myneni 2020-04-17 912 int ct_842 = 0, ct_gzip = 0;
4aebf3ce26ca212 drivers/crypto/nx/nx-common-powernv.c Haren Myneni 2020-04-17 913 struct device_node *dn;
b0d6c9bab5e41d0 drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2017-08-31 914
b0d6c9bab5e41d0 drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2017-08-31 915 chip_id = of_get_ibm_chip_id(pn);
b0d6c9bab5e41d0 drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2017-08-31 916 if (chip_id < 0) {
b0d6c9bab5e41d0 drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2017-08-31 917 pr_err("ibm,chip-id missing\n");
b0d6c9bab5e41d0 drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2017-08-31 918 return -EINVAL;
b0d6c9bab5e41d0 drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2017-08-31 919 }
b0d6c9bab5e41d0 drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2017-08-31 920
d4ef61b5e8955fb drivers/crypto/nx/nx-842-powernv.c Sukadev Bhattiprolu 2017-11-07 921 vasid = chip_to_vas_id(chip_id);
d4ef61b5e8955fb drivers/crypto/nx/nx-842-powernv.c Sukadev Bhattiprolu 2017-11-07 922 if (vasid < 0) {
d4ef61b5e8955fb drivers/crypto/nx/nx-842-powernv.c Sukadev Bhattiprolu 2017-11-07 923 pr_err("Unable to map chip_id %d to vasid\n", chip_id);
b0d6c9bab5e41d0 drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2017-08-31 924 return -EINVAL;
b0d6c9bab5e41d0 drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2017-08-31 925 }
b0d6c9bab5e41d0 drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2017-08-31 926
b0d6c9bab5e41d0 drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2017-08-31 927 for_each_child_of_node(pn, dn) {
4aebf3ce26ca212 drivers/crypto/nx/nx-common-powernv.c Haren Myneni 2020-04-17 928 ret = find_nx_device_tree(dn, chip_id, vasid, NX_CT_842,
4aebf3ce26ca212 drivers/crypto/nx/nx-common-powernv.c Haren Myneni 2020-04-17 929 "ibm,p9-nx-842", &ct_842);
1af11ae225350a9 drivers/crypto/nx/nx-common-powernv.c Haren Myneni 2020-04-17 930
1af11ae225350a9 drivers/crypto/nx/nx-common-powernv.c Haren Myneni 2020-04-17 931 if (!ret)
1af11ae225350a9 drivers/crypto/nx/nx-common-powernv.c Haren Myneni 2020-04-17 932 ret = find_nx_device_tree(dn, chip_id, vasid,
1af11ae225350a9 drivers/crypto/nx/nx-common-powernv.c Haren Myneni 2020-04-17 933 NX_CT_GZIP, "ibm,p9-nx-gzip", &ct_gzip);
1af11ae225350a9 drivers/crypto/nx/nx-common-powernv.c Haren Myneni 2020-04-17 934
4aebf3ce26ca212 drivers/crypto/nx/nx-common-powernv.c Haren Myneni 2020-04-17 @935 if (ret)
828d2f285428377 drivers/crypto/nx/nx-common-powernv.c Yang Li 2021-02-25 936 of_node_put(dn);
b0d6c9bab5e41d0 drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2017-08-31 937 return ret;
b0d6c9bab5e41d0 drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2017-08-31 938 }
b0d6c9bab5e41d0 drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2017-08-31 939
1af11ae225350a9 drivers/crypto/nx/nx-common-powernv.c Haren Myneni 2020-04-17 940 if (!ct_842 || !ct_gzip) {
1af11ae225350a9 drivers/crypto/nx/nx-common-powernv.c Haren Myneni 2020-04-17 941 pr_err("NX FIFO nodes are missing\n");
656ecc16e8fc2ab drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2018-06-13 942 return -EINVAL;
656ecc16e8fc2ab drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2018-06-13 943 }
656ecc16e8fc2ab drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2018-06-13 944
656ecc16e8fc2ab drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2018-06-13 945 /*
656ecc16e8fc2ab drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2018-06-13 946 * Initialize NX instance for both high and normal priority FIFOs.
656ecc16e8fc2ab drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2018-06-13 947 */
1af11ae225350a9 drivers/crypto/nx/nx-common-powernv.c Haren Myneni 2020-04-17 948 ret = nx_coproc_init(chip_id, ct_842, ct_gzip);
b0d6c9bab5e41d0 drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2017-08-31 949
b0d6c9bab5e41d0 drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2017-08-31 950 return ret;
b0d6c9bab5e41d0 drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2017-08-31 951 }
b0d6c9bab5e41d0 drivers/crypto/nx/nx-842-powernv.c Haren Myneni 2017-08-31 952
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]