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: <48e217a7-b90e-4af3-b535-812c449dd3ba@web.de>
Date: Tue, 24 Jun 2025 19:12:07 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: linux-can@...r.kernel.org, Marc Kleine-Budde <mkl@...gutronix.de>,
 Vincent Mailhol <mailhol.vincent@...adoo.fr>
Cc: LKML <linux-kernel@...r.kernel.org>, kernel-janitors@...r.kernel.org,
 Chen Ni <nichen@...as.ac.cn>
Subject: [PATCH] can: ucan: Use usb_endpoint_type() rather than duplicating
 its implementation

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Tue, 24 Jun 2025 19:05:04 +0200

Reuse existing functionality from usb_endpoint_type() instead of keeping
duplicate source code.

The source code was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 drivers/net/can/usb/ucan.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/can/usb/ucan.c b/drivers/net/can/usb/ucan.c
index 07406daf7c88..3c8dad8bcca4 100644
--- a/drivers/net/can/usb/ucan.c
+++ b/drivers/net/can/usb/ucan.c
@@ -1353,16 +1353,14 @@ static int ucan_probe(struct usb_interface *intf,
 		ep = &iface_desc->endpoint[i].desc;
 
 		if (((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) != 0) &&
-		    ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
-		     USB_ENDPOINT_XFER_BULK)) {
+		    usb_endpoint_type(ep) == USB_ENDPOINT_XFER_BULK) {
 			/* In Endpoint */
 			in_ep_addr = ep->bEndpointAddress;
 			in_ep_addr &= USB_ENDPOINT_NUMBER_MASK;
 			in_ep_size = le16_to_cpu(ep->wMaxPacketSize);
 		} else if (((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) ==
 			    0) &&
-			   ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
-			    USB_ENDPOINT_XFER_BULK)) {
+			   usb_endpoint_type(ep) == USB_ENDPOINT_XFER_BULK) {
 			/* Out Endpoint */
 			out_ep_addr = ep->bEndpointAddress;
 			out_ep_addr &= USB_ENDPOINT_NUMBER_MASK;
-- 
2.50.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ