[PATCH] HID: playstation: remove unreachable code

Jiapeng Chong posted 1 patch 3 years, 4 months ago
There is a newer version of this series
drivers/hid/hid-playstation.c | 2 --
1 file changed, 2 deletions(-)
[PATCH] HID: playstation: remove unreachable code
Posted by Jiapeng Chong 3 years, 4 months ago
The function dualshock4_get_calibration_data cannot execute hid_err,
delete the invalid code.

drivers/hid/hid-playstation.c:1766 dualshock4_get_calibration_data() warn: ignoring unreachable code.

Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3073
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 drivers/hid/hid-playstation.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c
index bae3e712a562..a4106f760d1f 100644
--- a/drivers/hid/hid-playstation.c
+++ b/drivers/hid/hid-playstation.c
@@ -1763,8 +1763,6 @@ static int dualshock4_get_calibration_data(struct dualshock4 *ds4)
 					ret = -EILSEQ;
 					goto err_free;
 				}
-				hid_err(hdev, "Failed to retrieve DualShock4 calibration info: %d\n", ret);
-				goto err_free;
 			} else {
 				break;
 			}
-- 
2.20.1.7.g153144c
Re: [PATCH] HID: playstation: remove unreachable code
Posted by Roderick Colenbrander 3 years, 4 months ago
On Mon, Nov 14, 2022 at 9:40 PM Jiapeng Chong
<jiapeng.chong@linux.alibaba.com> wrote:
>
> The function dualshock4_get_calibration_data cannot execute hid_err,
> delete the invalid code.
>
> drivers/hid/hid-playstation.c:1766 dualshock4_get_calibration_data() warn: ignoring unreachable code.
>
> Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3073
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>  drivers/hid/hid-playstation.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c
> index bae3e712a562..a4106f760d1f 100644
> --- a/drivers/hid/hid-playstation.c
> +++ b/drivers/hid/hid-playstation.c
> @@ -1763,8 +1763,6 @@ static int dualshock4_get_calibration_data(struct dualshock4 *ds4)
>                                         ret = -EILSEQ;
>                                         goto err_free;
>                                 }
> -                               hid_err(hdev, "Failed to retrieve DualShock4 calibration info: %d\n", ret);
> -                               goto err_free;
>                         } else {
>                                 break;
>                         }
> --
> 2.20.1.7.g153144c
>

Thanks for pointing this out. The error message is actually needed and
should be moved either in the else statement or we just take the else
statement.

Thanks,
Roderick