Skip to contentSkip to conversation

media: rc: ttusbir: respect DMA coherency rules

PATCH New Oliver Neukum 1 participant 1 message Feb 11

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 3/4 media: rc: ttusbir: respect DMA coherency rules

Buffers must not share a cache line with other data structures. Allocate seperately.

Fixes 0938069fa0897 ("[media] rc: Add support for the TechnoTrend USB IR Receiver")
---
 drivers/media/rc/ttusbir.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/media/rc/ttusbir.c +7 -2
index 560a26f3965c..b82c8c18bca1 100644
@@ -32,7 +32,7 @@ struct ttusbir {
 
 	struct led_classdev led;
 	struct urb *bulk_urb;
-	uint8_t bulk_buffer[5];
+	u8 *bulk_buffer;
 	int bulk_out_endp, iso_in_endp;
 	bool led_on, is_led_on;
 	atomic_t led_complete;
@@ -186,13 +186,16 @@ static int ttusbir_probe(struct usb_interface *intf,
 	struct rc_dev *rc;
 	int i, j, ret;
 	int altsetting = -1;
+	u8 *buffer;
 
 	tt = kzalloc(sizeof(*tt), GFP_KERNEL);
+	buffer = kzalloc(5, GFP_KERNEL);
 	rc = rc_allocate_device(RC_DRIVER_IR_RAW);
-	if (!tt || !rc) {
+	if (!tt || !rc || buffer) {
 		ret = -ENOMEM;
 		goto out;
 	}
+	tt->bulk_buffer = buffer;
 
 	/* find the correct alt setting */
 	for (i = 0; i < intf->num_altsetting && altsetting == -1; i++) {
@@ -351,6 +354,7 @@ static int ttusbir_probe(struct usb_interface *intf,
 		kfree(tt);
 	}
 	rc_free_device(rc);
+	kfree(buffer);
 
 	return ret;
 }
@@ -373,6 +377,7 @@ static void ttusbir_disconnect(struct usb_interface *intf)
 	}
 	usb_kill_urb(tt->bulk_urb);
 	usb_free_urb(tt->bulk_urb);
+	kfree(tt->bulk_buffer);
 	usb_set_intfdata(intf, NULL);
 	kfree(tt);
 }
Signature · 1 line
2.53.0