From 1efca6ba93b0ce8db4a5468c4886bee8c78eb0fe Mon Sep 17 00:00:00 2001 From: David Rosen Date: Thu, 5 Jan 2023 13:28:14 -0800 Subject: [PATCH] Return err code when a Ringbuffer is full or inaccessible esp_rb_write_by_kernel() returns the number of bytes written; and it is called repeatedly until the entire length of the packet has been transferred. In the case of a full/inaccessible ringbuffer, it was returning zero, causing the caller to invoke the function in a tight loop. Fixed to return -EFAULT. --- esp_hosted_fg/host/linux/host_driver/esp32/esp_rb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esp_hosted_fg/host/linux/host_driver/esp32/esp_rb.c b/esp_hosted_fg/host/linux/host_driver/esp32/esp_rb.c index 3b5ed8bee2..9a4522a5e9 100644 --- a/esp_hosted_fg/host/linux/host_driver/esp32/esp_rb.c +++ b/esp_hosted_fg/host/linux/host_driver/esp32/esp_rb.c @@ -116,7 +116,7 @@ int esp_rb_write_by_kernel(esp_rb_t *rb, const char *buf, size_t sz) if (get_free_space(rb) <= 0) { up(&rb->sem); printk(KERN_ERR "%s, %d, Ringbuffer full or inaccessible\n", __func__, __LINE__); - return 0; + return -EFAULT; } sz = min(sz, (size_t)get_free_space(rb));