* [PATCH][next] misc: hisi_hikey_usb: fix return of uninitialized ret status variable
@ 2020-09-14 13:56 Colin King
2020-09-14 14:13 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2020-09-14 13:56 UTC (permalink / raw)
To: John Stultz, Arnd Bergmann, Greg Kroah-Hartman, Mauro Carvalho Chehab
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
Currently the return value from ret is uninitialized so the function
hisi_hikey_usb_parse_kirin970 is returning a garbage value when
succeeding. Since ret is not used anywhere else in the function, remove
it and just return 0 success at the end of the function.
Addresses-Coverity: ("Uninitialixed scalar variable")
Fixes: d210a0023590 ("misc: hisi_hikey_usb: add support for Hikey 970")
Signed-off-by: Colin Ian King <colin.king@canonical.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.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][next] misc: hisi_hikey_usb: fix return of uninitialized ret status variable
2020-09-14 13:56 [PATCH][next] misc: hisi_hikey_usb: fix return of uninitialized ret status variable Colin King
@ 2020-09-14 14:13 ` Mauro Carvalho Chehab
0 siblings, 0 replies; 2+ messages in thread
From: Mauro Carvalho Chehab @ 2020-09-14 14:13 UTC (permalink / raw)
To: Colin King
Cc: John Stultz, Arnd Bergmann, Greg Kroah-Hartman, kernel-janitors,
linux-kernel
Em Mon, 14 Sep 2020 14:56:46 +0100
Colin King <colin.king@canonical.com> escreveu:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently the return value from ret is uninitialized so the function
> hisi_hikey_usb_parse_kirin970 is returning a garbage value when
> succeeding. Since ret is not used anywhere else in the function, remove
> it and just return 0 success at the end of the function.
>
> Addresses-Coverity: ("Uninitialixed scalar variable")
> Fixes: d210a0023590 ("misc: hisi_hikey_usb: add support for Hikey 970")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> ---
> 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)
Thanks,
Mauro
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-14 14:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14 13:56 [PATCH][next] misc: hisi_hikey_usb: fix return of uninitialized ret status variable Colin King
2020-09-14 14:13 ` Mauro Carvalho Chehab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).