diff for duplicates of <202203111754.32TAMFKD-lkp@intel.com> diff --git a/a/1.txt b/N1/1.txt index 6ea8582..3855d7f 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -1,15 +1,6 @@ -CC: kbuild-all(a)lists.01.org -BCC: lkp(a)intel.com -CC: Linux Memory Management List <linux-mm@kvack.org> -TO: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com> -CC: Mark Brown <broonie@kernel.org> -CC: Venkata Prasad Potturu <quic_potturu@quicinc.com> - tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 71941773e143369a73c9c4a3b62fbb60736a1182 commit: 9e3d83c52844f955aa2975f78cee48bf9f72f5e1 [8752/11953] ASoC: codecs: Add power domains support in digital macro codecs -:::::: branch date: 25 hours ago -:::::: commit date: 11 days ago config: arm-randconfig-m031-20220310 (https://download.01.org/0day-ci/archive/20220311/202203111754.32TAMFKD-lkp(a)intel.com/config) compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0 @@ -22,7 +13,6 @@ sound/soc/codecs/lpass-macro-common.c:53 lpass_macro_pds_init() warn: passing ze vim +/ERR_PTR +53 sound/soc/codecs/lpass-macro-common.c -9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 13 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 14 struct lpass_macro *lpass_macro_pds_init(struct device *dev) 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 15 { 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 16 struct lpass_macro *l_pds; @@ -30,16 +20,45 @@ vim +/ERR_PTR +53 sound/soc/codecs/lpass-macro-common.c 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 18 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 19 if (!of_find_property(dev->of_node, "power-domains", NULL)) 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 20 return NULL; + +Returning NULL here will lead to a crash in tx_macro_runtime_resume() + +When a function returns a mix of NULL and error pointers, then NULL +means the feature is deliberately disabled. It's not an error, it's a +deliberate choice by the distro or sys admin. The caller has to +be written to allow the feature to be disabled. + +An example of this might be LEDs. Maybe people don't want LEDs so code +has to asume that the led->ops pointer might be NULL and check for that +before dereferencing it. + 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 21 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 22 l_pds = devm_kzalloc(dev, sizeof(*l_pds), GFP_KERNEL); 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 23 if (!l_pds) 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 24 return ERR_PTR(-ENOMEM); + +Good. + 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 25 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 26 l_pds->macro_pd = dev_pm_domain_attach_by_name(dev, "macro"); 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 27 if (IS_ERR_OR_NULL(l_pds->macro_pd)) 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 28 return NULL; + +If this feature is optional then it should be: + + if (IS_ERR_OR_NULL(l_pds->macro_pd)) + return ERR_CAST(l_pds->macro_pd); + +The admin deliberately chose to enable the feature so we can't just +ignore errors and convert them to NULL. + 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 29 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 30 ret = pm_runtime_get_sync(l_pds->macro_pd); + +This is correct, but the documentation for pm_runtime_get_sync() says to +consider pm_runtime_resume_and_get() instead. The error handling is +slightly different and easier. I forget the details. + 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 31 if (ret < 0) { 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 32 pm_runtime_put_noidle(l_pds->macro_pd); 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 33 goto macro_err; @@ -48,6 +67,14 @@ vim +/ERR_PTR +53 sound/soc/codecs/lpass-macro-common.c 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 36 l_pds->dcodec_pd = dev_pm_domain_attach_by_name(dev, "dcodec"); 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 37 if (IS_ERR_OR_NULL(l_pds->dcodec_pd)) 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 38 goto dcodec_err; + +Again this IS_ERR_OR_NULL() check needs to preserve the error codes: + + if (IS_ERR_OR_NULL(l_pds->dcodec_pd)) { + ret = PTR_ERR(l_pds->dcodec_pd); + goto dcodec_err; + } + 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 39 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 40 ret = pm_runtime_get_sync(l_pds->dcodec_pd); 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 41 if (ret < 0) { @@ -64,8 +91,6 @@ vim +/ERR_PTR +53 sound/soc/codecs/lpass-macro-common.c 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 52 dev_pm_domain_detach(l_pds->macro_pd, false); 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 @53 return ERR_PTR(ret); 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 54 } -9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 55 EXPORT_SYMBOL_GPL(lpass_macro_pds_init); -9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 56 --- 0-DAY CI Kernel Test Service diff --git a/a/content_digest b/N1/content_digest index 3b7bee0..b0e7fb3 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -1,21 +1,12 @@ - "From\0kernel test robot <lkp@intel.com>\0" + "From\0Dan Carpenter <dan.carpenter@oracle.com>\0" "Subject\0[linux-next:master 8752/11953] sound/soc/codecs/lpass-macro-common.c:53 lpass_macro_pds_init() warn: passing zero to 'ERR_PTR'\0" - "Date\0Fri, 11 Mar 2022 17:47:14 +0800\0" - "To\0kbuild@lists.01.org\0" + "Date\0Fri, 11 Mar 2022 14:53:24 +0300\0" + "To\0kbuild-all@lists.01.org\0" "\01:1\0" "b\0" - "CC: kbuild-all(a)lists.01.org\n" - "BCC: lkp(a)intel.com\n" - "CC: Linux Memory Management List <linux-mm@kvack.org>\n" - "TO: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>\n" - "CC: Mark Brown <broonie@kernel.org>\n" - "CC: Venkata Prasad Potturu <quic_potturu@quicinc.com>\n" - "\n" "tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master\n" "head: 71941773e143369a73c9c4a3b62fbb60736a1182\n" "commit: 9e3d83c52844f955aa2975f78cee48bf9f72f5e1 [8752/11953] ASoC: codecs: Add power domains support in digital macro codecs\n" - ":::::: branch date: 25 hours ago\n" - ":::::: commit date: 11 days ago\n" "config: arm-randconfig-m031-20220310 (https://download.01.org/0day-ci/archive/20220311/202203111754.32TAMFKD-lkp(a)intel.com/config)\n" "compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0\n" "\n" @@ -28,7 +19,6 @@ "\n" "vim +/ERR_PTR +53 sound/soc/codecs/lpass-macro-common.c\n" "\n" - "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 13 \n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 14 struct lpass_macro *lpass_macro_pds_init(struct device *dev)\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 15 {\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 16 \tstruct lpass_macro *l_pds;\n" @@ -36,16 +26,45 @@ "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 18 \n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 19 \tif (!of_find_property(dev->of_node, \"power-domains\", NULL))\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 20 \t\treturn NULL;\n" + "\n" + "Returning NULL here will lead to a crash in tx_macro_runtime_resume()\n" + "\n" + "When a function returns a mix of NULL and error pointers, then NULL\n" + "means the feature is deliberately disabled. It's not an error, it's a\n" + "deliberate choice by the distro or sys admin. The caller has to\n" + "be written to allow the feature to be disabled.\n" + "\n" + "An example of this might be LEDs. Maybe people don't want LEDs so code\n" + "has to asume that the led->ops pointer might be NULL and check for that\n" + "before dereferencing it.\n" + "\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 21 \n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 22 \tl_pds = devm_kzalloc(dev, sizeof(*l_pds), GFP_KERNEL);\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 23 \tif (!l_pds)\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 24 \t\treturn ERR_PTR(-ENOMEM);\n" + "\n" + "Good.\n" + "\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 25 \n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 26 \tl_pds->macro_pd = dev_pm_domain_attach_by_name(dev, \"macro\");\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 27 \tif (IS_ERR_OR_NULL(l_pds->macro_pd))\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 28 \t\treturn NULL;\n" + "\n" + "If this feature is optional then it should be:\n" + "\n" + "\tif (IS_ERR_OR_NULL(l_pds->macro_pd))\n" + "\t\treturn ERR_CAST(l_pds->macro_pd);\n" + "\n" + "The admin deliberately chose to enable the feature so we can't just\n" + "ignore errors and convert them to NULL.\n" + "\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 29 \n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 30 \tret = pm_runtime_get_sync(l_pds->macro_pd);\n" + "\n" + "This is correct, but the documentation for pm_runtime_get_sync() says to\n" + "consider pm_runtime_resume_and_get() instead. The error handling is\n" + "slightly different and easier. I forget the details.\n" + "\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 31 \tif (ret < 0) {\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 32 \t\tpm_runtime_put_noidle(l_pds->macro_pd);\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 33 \t\tgoto macro_err;\n" @@ -54,6 +73,14 @@ "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 36 \tl_pds->dcodec_pd = dev_pm_domain_attach_by_name(dev, \"dcodec\");\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 37 \tif (IS_ERR_OR_NULL(l_pds->dcodec_pd))\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 38 \t\tgoto dcodec_err;\n" + "\n" + "Again this IS_ERR_OR_NULL() check needs to preserve the error codes:\n" + "\n" + "\tif (IS_ERR_OR_NULL(l_pds->dcodec_pd)) {\n" + "\t\tret = PTR_ERR(l_pds->dcodec_pd);\n" + "\t\tgoto dcodec_err;\n" + "\t}\n" + "\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 39 \n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 40 \tret = pm_runtime_get_sync(l_pds->dcodec_pd);\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 41 \tif (ret < 0) {\n" @@ -70,11 +97,9 @@ "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 52 \tdev_pm_domain_detach(l_pds->macro_pd, false);\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 @53 \treturn ERR_PTR(ret);\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 54 }\n" - "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 55 EXPORT_SYMBOL_GPL(lpass_macro_pds_init);\n" - "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 56 \n" "\n" "---\n" "0-DAY CI Kernel Test Service\n" https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org -7b504426424e24dba8ee263cc3e78f4e2d95459eeddfa43e029bdc46b44de4a0 +e0a07d4ccb663ae262ec708071a340db557ebbf6930d319c90a230e09e993276
diff --git a/a/1.txt b/N2/1.txt index 6ea8582..e43391e 100644 --- a/a/1.txt +++ b/N2/1.txt @@ -1,16 +1,7 @@ -CC: kbuild-all(a)lists.01.org -BCC: lkp(a)intel.com -CC: Linux Memory Management List <linux-mm@kvack.org> -TO: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com> -CC: Mark Brown <broonie@kernel.org> -CC: Venkata Prasad Potturu <quic_potturu@quicinc.com> - tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 71941773e143369a73c9c4a3b62fbb60736a1182 commit: 9e3d83c52844f955aa2975f78cee48bf9f72f5e1 [8752/11953] ASoC: codecs: Add power domains support in digital macro codecs -:::::: branch date: 25 hours ago -:::::: commit date: 11 days ago -config: arm-randconfig-m031-20220310 (https://download.01.org/0day-ci/archive/20220311/202203111754.32TAMFKD-lkp(a)intel.com/config) +config: arm-randconfig-m031-20220310 (https://download.01.org/0day-ci/archive/20220311/202203111754.32TAMFKD-lkp@intel.com/config) compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0 If you fix the issue, kindly add following tag as appropriate @@ -22,7 +13,6 @@ sound/soc/codecs/lpass-macro-common.c:53 lpass_macro_pds_init() warn: passing ze vim +/ERR_PTR +53 sound/soc/codecs/lpass-macro-common.c -9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 13 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 14 struct lpass_macro *lpass_macro_pds_init(struct device *dev) 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 15 { 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 16 struct lpass_macro *l_pds; @@ -30,16 +20,45 @@ vim +/ERR_PTR +53 sound/soc/codecs/lpass-macro-common.c 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 18 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 19 if (!of_find_property(dev->of_node, "power-domains", NULL)) 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 20 return NULL; + +Returning NULL here will lead to a crash in tx_macro_runtime_resume() + +When a function returns a mix of NULL and error pointers, then NULL +means the feature is deliberately disabled. It's not an error, it's a +deliberate choice by the distro or sys admin. The caller has to +be written to allow the feature to be disabled. + +An example of this might be LEDs. Maybe people don't want LEDs so code +has to asume that the led->ops pointer might be NULL and check for that +before dereferencing it. + 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 21 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 22 l_pds = devm_kzalloc(dev, sizeof(*l_pds), GFP_KERNEL); 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 23 if (!l_pds) 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 24 return ERR_PTR(-ENOMEM); + +Good. + 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 25 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 26 l_pds->macro_pd = dev_pm_domain_attach_by_name(dev, "macro"); 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 27 if (IS_ERR_OR_NULL(l_pds->macro_pd)) 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 28 return NULL; + +If this feature is optional then it should be: + + if (IS_ERR_OR_NULL(l_pds->macro_pd)) + return ERR_CAST(l_pds->macro_pd); + +The admin deliberately chose to enable the feature so we can't just +ignore errors and convert them to NULL. + 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 29 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 30 ret = pm_runtime_get_sync(l_pds->macro_pd); + +This is correct, but the documentation for pm_runtime_get_sync() says to +consider pm_runtime_resume_and_get() instead. The error handling is +slightly different and easier. I forget the details. + 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 31 if (ret < 0) { 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 32 pm_runtime_put_noidle(l_pds->macro_pd); 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 33 goto macro_err; @@ -48,6 +67,14 @@ vim +/ERR_PTR +53 sound/soc/codecs/lpass-macro-common.c 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 36 l_pds->dcodec_pd = dev_pm_domain_attach_by_name(dev, "dcodec"); 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 37 if (IS_ERR_OR_NULL(l_pds->dcodec_pd)) 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 38 goto dcodec_err; + +Again this IS_ERR_OR_NULL() check needs to preserve the error codes: + + if (IS_ERR_OR_NULL(l_pds->dcodec_pd)) { + ret = PTR_ERR(l_pds->dcodec_pd); + goto dcodec_err; + } + 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 39 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 40 ret = pm_runtime_get_sync(l_pds->dcodec_pd); 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 41 if (ret < 0) { @@ -64,9 +91,7 @@ vim +/ERR_PTR +53 sound/soc/codecs/lpass-macro-common.c 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 52 dev_pm_domain_detach(l_pds->macro_pd, false); 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 @53 return ERR_PTR(ret); 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 54 } -9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 55 EXPORT_SYMBOL_GPL(lpass_macro_pds_init); -9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 56 --- 0-DAY CI Kernel Test Service -https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org +https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org diff --git a/a/content_digest b/N2/content_digest index 3b7bee0..043140b 100644 --- a/a/content_digest +++ b/N2/content_digest @@ -1,22 +1,19 @@ - "From\0kernel test robot <lkp@intel.com>\0" + "From\0Dan Carpenter <dan.carpenter@oracle.com>\0" "Subject\0[linux-next:master 8752/11953] sound/soc/codecs/lpass-macro-common.c:53 lpass_macro_pds_init() warn: passing zero to 'ERR_PTR'\0" - "Date\0Fri, 11 Mar 2022 17:47:14 +0800\0" - "To\0kbuild@lists.01.org\0" - "\01:1\0" + "Date\0Fri, 11 Mar 2022 14:53:24 +0300\0" + "To\0kbuild@lists.01.org" + " Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>\0" + "Cc\0lkp@intel.com" + kbuild-all@lists.01.org + Linux Memory Management List <linux-mm@kvack.org> + Mark Brown <broonie@kernel.org> + " Venkata Prasad Potturu <quic_potturu@quicinc.com>\0" + "\00:1\0" "b\0" - "CC: kbuild-all(a)lists.01.org\n" - "BCC: lkp(a)intel.com\n" - "CC: Linux Memory Management List <linux-mm@kvack.org>\n" - "TO: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>\n" - "CC: Mark Brown <broonie@kernel.org>\n" - "CC: Venkata Prasad Potturu <quic_potturu@quicinc.com>\n" - "\n" "tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master\n" "head: 71941773e143369a73c9c4a3b62fbb60736a1182\n" "commit: 9e3d83c52844f955aa2975f78cee48bf9f72f5e1 [8752/11953] ASoC: codecs: Add power domains support in digital macro codecs\n" - ":::::: branch date: 25 hours ago\n" - ":::::: commit date: 11 days ago\n" - "config: arm-randconfig-m031-20220310 (https://download.01.org/0day-ci/archive/20220311/202203111754.32TAMFKD-lkp(a)intel.com/config)\n" + "config: arm-randconfig-m031-20220310 (https://download.01.org/0day-ci/archive/20220311/202203111754.32TAMFKD-lkp@intel.com/config)\n" "compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0\n" "\n" "If you fix the issue, kindly add following tag as appropriate\n" @@ -28,7 +25,6 @@ "\n" "vim +/ERR_PTR +53 sound/soc/codecs/lpass-macro-common.c\n" "\n" - "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 13 \n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 14 struct lpass_macro *lpass_macro_pds_init(struct device *dev)\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 15 {\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 16 \tstruct lpass_macro *l_pds;\n" @@ -36,16 +32,45 @@ "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 18 \n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 19 \tif (!of_find_property(dev->of_node, \"power-domains\", NULL))\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 20 \t\treturn NULL;\n" + "\n" + "Returning NULL here will lead to a crash in tx_macro_runtime_resume()\n" + "\n" + "When a function returns a mix of NULL and error pointers, then NULL\n" + "means the feature is deliberately disabled. It's not an error, it's a\n" + "deliberate choice by the distro or sys admin. The caller has to\n" + "be written to allow the feature to be disabled.\n" + "\n" + "An example of this might be LEDs. Maybe people don't want LEDs so code\n" + "has to asume that the led->ops pointer might be NULL and check for that\n" + "before dereferencing it.\n" + "\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 21 \n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 22 \tl_pds = devm_kzalloc(dev, sizeof(*l_pds), GFP_KERNEL);\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 23 \tif (!l_pds)\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 24 \t\treturn ERR_PTR(-ENOMEM);\n" + "\n" + "Good.\n" + "\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 25 \n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 26 \tl_pds->macro_pd = dev_pm_domain_attach_by_name(dev, \"macro\");\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 27 \tif (IS_ERR_OR_NULL(l_pds->macro_pd))\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 28 \t\treturn NULL;\n" + "\n" + "If this feature is optional then it should be:\n" + "\n" + "\tif (IS_ERR_OR_NULL(l_pds->macro_pd))\n" + "\t\treturn ERR_CAST(l_pds->macro_pd);\n" + "\n" + "The admin deliberately chose to enable the feature so we can't just\n" + "ignore errors and convert them to NULL.\n" + "\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 29 \n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 30 \tret = pm_runtime_get_sync(l_pds->macro_pd);\n" + "\n" + "This is correct, but the documentation for pm_runtime_get_sync() says to\n" + "consider pm_runtime_resume_and_get() instead. The error handling is\n" + "slightly different and easier. I forget the details.\n" + "\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 31 \tif (ret < 0) {\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 32 \t\tpm_runtime_put_noidle(l_pds->macro_pd);\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 33 \t\tgoto macro_err;\n" @@ -54,6 +79,14 @@ "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 36 \tl_pds->dcodec_pd = dev_pm_domain_attach_by_name(dev, \"dcodec\");\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 37 \tif (IS_ERR_OR_NULL(l_pds->dcodec_pd))\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 38 \t\tgoto dcodec_err;\n" + "\n" + "Again this IS_ERR_OR_NULL() check needs to preserve the error codes:\n" + "\n" + "\tif (IS_ERR_OR_NULL(l_pds->dcodec_pd)) {\n" + "\t\tret = PTR_ERR(l_pds->dcodec_pd);\n" + "\t\tgoto dcodec_err;\n" + "\t}\n" + "\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 39 \n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 40 \tret = pm_runtime_get_sync(l_pds->dcodec_pd);\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 41 \tif (ret < 0) {\n" @@ -70,11 +103,9 @@ "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 52 \tdev_pm_domain_detach(l_pds->macro_pd, false);\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 @53 \treturn ERR_PTR(ret);\n" "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 54 }\n" - "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 55 EXPORT_SYMBOL_GPL(lpass_macro_pds_init);\n" - "9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26 56 \n" "\n" "---\n" "0-DAY CI Kernel Test Service\n" - https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org + https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org -7b504426424e24dba8ee263cc3e78f4e2d95459eeddfa43e029bdc46b44de4a0 +aed488517165a0469dba07c3dbf2c9ea0b2ea4e7c460faf16b000da970ceb48c
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.