* [PATCH] usb: dwc3: rtk: Clean up error code in __get_dwc3_maximum_speed()
@ 2024-09-12 8:54 Dan Carpenter
2024-09-16 10:28 ` Krzysztof Kozlowski
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2024-09-12 8:54 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Thinh Nguyen, Greg Kroah-Hartman, linux-usb, linux-kernel,
kernel-janitors
The __get_dwc3_maximum_speed() function returns an enum type which, in
this context here, is basically unsigned int. On error cases, it's
supposed to return USB_SPEED_UNKNOWN, but it was accidentally changed to
return negative error codes in commit f93e96c544ca ("usb: dwc3: rtk: use
scoped device node handling to simplify error paths").
There is only one caller and because of the way that the types work out,
returning negative error codes is not a problem. They will be treated
as greater than USB_SPEED_HIGH and ignored as invalid. So this patch
does not affect run time behavior, it's just a clean up.
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/usb/dwc3/dwc3-rtk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/dwc3-rtk.c b/drivers/usb/dwc3/dwc3-rtk.c
index b3db5cd9906e..e9c8b032c72c 100644
--- a/drivers/usb/dwc3/dwc3-rtk.c
+++ b/drivers/usb/dwc3/dwc3-rtk.c
@@ -184,7 +184,7 @@ static enum usb_device_speed __get_dwc3_maximum_speed(struct device_node *np)
ret = of_property_read_string(dwc3_np, "maximum-speed", &maximum_speed);
if (ret < 0)
- return ret;
+ return USB_SPEED_UNKNOWN;
ret = match_string(speed_names, ARRAY_SIZE(speed_names), maximum_speed);
--
2.45.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] usb: dwc3: rtk: Clean up error code in __get_dwc3_maximum_speed()
2024-09-12 8:54 [PATCH] usb: dwc3: rtk: Clean up error code in __get_dwc3_maximum_speed() Dan Carpenter
@ 2024-09-16 10:28 ` Krzysztof Kozlowski
0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Kozlowski @ 2024-09-16 10:28 UTC (permalink / raw)
To: Dan Carpenter
Cc: Thinh Nguyen, Greg Kroah-Hartman, linux-usb, linux-kernel,
kernel-janitors
On 12/09/2024 10:54, Dan Carpenter wrote:
> The __get_dwc3_maximum_speed() function returns an enum type which, in
> this context here, is basically unsigned int. On error cases, it's
> supposed to return USB_SPEED_UNKNOWN, but it was accidentally changed to
> return negative error codes in commit f93e96c544ca ("usb: dwc3: rtk: use
> scoped device node handling to simplify error paths").
>
> There is only one caller and because of the way that the types work out,
> returning negative error codes is not a problem. They will be treated
> as greater than USB_SPEED_HIGH and ignored as invalid. So this patch
> does not affect run time behavior, it's just a clean up.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Fixes: f93e96c544ca ("usb: dwc3: rtk: use scoped device node handling to simplify error paths")
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-09-16 10:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-12 8:54 [PATCH] usb: dwc3: rtk: Clean up error code in __get_dwc3_maximum_speed() Dan Carpenter
2024-09-16 10:28 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®