lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <865e56dc-37cc-47b1-8d35-9047ecb1984a@stanley.mountain>
Date: Thu, 12 Sep 2024 11:54:09 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Cc: Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
	kernel-janitors@...r.kernel.org
Subject: [PATCH] usb: dwc3: rtk: Clean up error code in
 __get_dwc3_maximum_speed()

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@...aro.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ