Skip to content

Commit c6e8d85

Browse files
gShahrgregkh
authored andcommitted
staging: axis-fifo: Remove hardware resets for user errors
The axis-fifo driver performs a full hardware reset (via reset_ip_core()) in several error paths within the read and write functions. This reset flushes both TX and RX FIFOs and resets the AXI-Stream links. Allow the user to handle the error without causing hardware disruption or data loss in other FIFO paths. Fixes: 4a965c5 ("staging: add driver for Xilinx AXI-Stream FIFO v4.1 IP core") Cc: stable@vger.kernel.org Signed-off-by: Gabriel Shahrouzi <gshahrouzi@gmail.com> Link: https://lore.kernel.org/r/20250419004306.669605-1-gshahrouzi@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2ca34b5 commit c6e8d85

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

drivers/staging/axis-fifo/axis-fifo.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -393,16 +393,14 @@ static ssize_t axis_fifo_read(struct file *f, char __user *buf,
393393

394394
bytes_available = ioread32(fifo->base_addr + XLLF_RLR_OFFSET);
395395
if (!bytes_available) {
396-
dev_err(fifo->dt_device, "received a packet of length 0 - fifo core will be reset\n");
397-
reset_ip_core(fifo);
396+
dev_err(fifo->dt_device, "received a packet of length 0\n");
398397
ret = -EIO;
399398
goto end_unlock;
400399
}
401400

402401
if (bytes_available > len) {
403-
dev_err(fifo->dt_device, "user read buffer too small (available bytes=%zu user buffer bytes=%zu) - fifo core will be reset\n",
402+
dev_err(fifo->dt_device, "user read buffer too small (available bytes=%zu user buffer bytes=%zu)\n",
404403
bytes_available, len);
405-
reset_ip_core(fifo);
406404
ret = -EINVAL;
407405
goto end_unlock;
408406
}
@@ -411,8 +409,7 @@ static ssize_t axis_fifo_read(struct file *f, char __user *buf,
411409
/* this probably can't happen unless IP
412410
* registers were previously mishandled
413411
*/
414-
dev_err(fifo->dt_device, "received a packet that isn't word-aligned - fifo core will be reset\n");
415-
reset_ip_core(fifo);
412+
dev_err(fifo->dt_device, "received a packet that isn't word-aligned\n");
416413
ret = -EIO;
417414
goto end_unlock;
418415
}
@@ -433,7 +430,6 @@ static ssize_t axis_fifo_read(struct file *f, char __user *buf,
433430

434431
if (copy_to_user(buf + copied * sizeof(u32), tmp_buf,
435432
copy * sizeof(u32))) {
436-
reset_ip_core(fifo);
437433
ret = -EFAULT;
438434
goto end_unlock;
439435
}
@@ -542,7 +538,6 @@ static ssize_t axis_fifo_write(struct file *f, const char __user *buf,
542538

543539
if (copy_from_user(tmp_buf, buf + copied * sizeof(u32),
544540
copy * sizeof(u32))) {
545-
reset_ip_core(fifo);
546541
ret = -EFAULT;
547542
goto end_unlock;
548543
}

0 commit comments

Comments
 (0)