All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] misc: hisi_hikey_usb: fix the uninitialized ret
@ 2020-09-15  3:01 Wei Xu
  2020-09-15 15:18 ` kernel test robot
  2020-09-15 15:18 ` [PATCH] misc: hisi_hikey_usb: fix ptr_ret.cocci warnings kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Xu @ 2020-09-15  3:01 UTC (permalink / raw)
  To: mchehab+huawei
  Cc: xuwei5, linuxarm, shameerali.kolothum.thodi, jonathan.cameron,
	john.garry, salil.mehta, shiju.jose, jinying, zhangyi.ac,
	liguozhu, tangkunshan, huangdaode, John Stultz, Arnd Bergmann,
	Greg Kroah-Hartman, linux-kernel

The uninitialized ret in hisi_hikey_usb_parse_kirin970 is useless.
Simply remove it and return 0 on success to fix the issue reported
by Coverity Scan.

Fixes: d210a0023590 ("misc: hisi_hikey_usb: add support for Hikey 970")
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
---
 drivers/misc/hisi_hikey_usb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/misc/hisi_hikey_usb.c b/drivers/misc/hisi_hikey_usb.c
index 2ddd4072788d..5759e7209023 100644
--- a/drivers/misc/hisi_hikey_usb.c
+++ b/drivers/misc/hisi_hikey_usb.c
@@ -151,7 +151,6 @@ static int hisi_hikey_usb_parse_kirin970(struct platform_device *pdev,
 					 struct hisi_hikey_usb *hisi_hikey_usb)
 {
 	struct regulator *regulator;
-	int ret;
 
 	regulator = devm_regulator_get(&pdev->dev, "hub-vdd");
 	if (IS_ERR(regulator)) {
@@ -172,7 +171,7 @@ static int hisi_hikey_usb_parse_kirin970(struct platform_device *pdev,
 	if (IS_ERR(hisi_hikey_usb->reset))
 		return PTR_ERR(hisi_hikey_usb->reset);
 
-	return ret;
+	return 0;
 }
 
 static int hisi_hikey_usb_probe(struct platform_device *pdev)
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] misc: hisi_hikey_usb: fix the uninitialized ret
  2020-09-15  3:01 [PATCH] misc: hisi_hikey_usb: fix the uninitialized ret Wei Xu
@ 2020-09-15 15:18 ` kernel test robot
  2020-09-15 15:18 ` [PATCH] misc: hisi_hikey_usb: fix ptr_ret.cocci warnings kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2020-09-15 15:18 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1077 bytes --]

Hi Wei,

I love your patch! Perhaps something to improve:

[auto build test WARNING on next-20200914]
[cannot apply to char-misc/char-misc-testing v5.9-rc5 v5.9-rc4 v5.9-rc3 v5.9-rc5]
[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/Wei-Xu/misc-hisi_hikey_usb-fix-the-uninitialized-ret/20200915-110654
base:    f965d3ec86fa89285db0fbb983da76ba9c398efa
config: x86_64-randconfig-c004-20200915 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


coccinelle warnings: (new ones prefixed by >>)

>> drivers/misc/hisi_hikey_usb.c:171:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Please review and possibly fold the followup patch.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 36244 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] misc: hisi_hikey_usb: fix ptr_ret.cocci warnings
  2020-09-15  3:01 [PATCH] misc: hisi_hikey_usb: fix the uninitialized ret Wei Xu
  2020-09-15 15:18 ` kernel test robot
@ 2020-09-15 15:18 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2020-09-15 15:18 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1049 bytes --]

From: kernel test robot <lkp@intel.com>

drivers/misc/hisi_hikey_usb.c:171:1-3: WARNING: PTR_ERR_OR_ZERO can be used


 Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

CC: Wei Xu <xuwei5@hisilicon.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---

url:    https://github.com/0day-ci/linux/commits/Wei-Xu/misc-hisi_hikey_usb-fix-the-uninitialized-ret/20200915-110654
base:    f965d3ec86fa89285db0fbb983da76ba9c398efa

 hisi_hikey_usb.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

--- a/drivers/misc/hisi_hikey_usb.c
+++ b/drivers/misc/hisi_hikey_usb.c
@@ -168,10 +168,7 @@ static int hisi_hikey_usb_parse_kirin970
 
 	hisi_hikey_usb->reset = devm_gpiod_get(&pdev->dev, "hub_reset_en_gpio",
 					       GPIOD_OUT_HIGH);
-	if (IS_ERR(hisi_hikey_usb->reset))
-		return PTR_ERR(hisi_hikey_usb->reset);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(hisi_hikey_usb->reset);
 }
 
 static int hisi_hikey_usb_probe(struct platform_device *pdev)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-15 15:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-15  3:01 [PATCH] misc: hisi_hikey_usb: fix the uninitialized ret Wei Xu
2020-09-15 15:18 ` kernel test robot
2020-09-15 15:18 ` [PATCH] misc: hisi_hikey_usb: fix ptr_ret.cocci warnings kernel test robot

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.