mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] staging: axis-fifo: Fix three real issues
@ 2026-10-22 21:53 Breno Rodrigues Alves
  2026-10-23  6:08 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 7+ messages in thread
From: Breno Rodrigues Alves @ 2026-10-22 21:53 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, Breno Rodrigues Alves

Fix three issues in the Xilinx AXI-Stream FIFO driver:

  1. axis_fifo_debugfs_init() did not check the return value of
     debugfs_create_dir().  When CONFIG_DEBUG_FS=n, the function
     returns ERR_PTR(-ENODEV); passing it as a parent to
     debugfs_create_file() triggers a WARN in the kernel debugfs
     core.  Bail out early if the directory was not created.

  2. axis_fifo_read() returned -EINVAL when the user buffer was
     smaller than the available data.  The user argument is not
     invalid - it is just too small - so return -ENOBUFS, which is
     the canonical errno for that situation (see recv(2)).

  3. axis_fifo_probe() filled in a 'struct resource *r_mem' pointer
     that is never read.  Pass NULL instead.

No functional change for the normal path.

Signed-off-by: Breno Rodrigues Alves <breno3011alves@gmail.com>
---
 drivers/staging/axis-fifo/axis-fifo.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c
index 3d358f919..c19cb68de 100644
--- a/drivers/staging/axis-fifo/axis-fifo.c
+++ b/drivers/staging/axis-fifo/axis-fifo.c
@@ -148,7 +148,7 @@ static ssize_t axis_fifo_read(struct file *f, char __user *buf,
 	words_available = bytes_available / sizeof(u32);
 
 	if (bytes_available > len) {
-		ret = -EINVAL;
+		ret = -ENOBUFS;
 		goto err_flush_rx;
 	}
 
@@ -378,6 +378,8 @@ DEFINE_SHOW_ATTRIBUTE(axis_fifo_debugfs_regs);
 static void axis_fifo_debugfs_init(struct axis_fifo *fifo)
 {
 	fifo->debugfs_dir = debugfs_create_dir(dev_name(fifo->dt_device), NULL);
+	if (IS_ERR_OR_NULL(fifo->debugfs_dir))
+		return;
 
 	debugfs_create_file("regs", 0444, fifo->debugfs_dir, fifo,
 			    &axis_fifo_debugfs_regs_fops);
@@ -428,7 +430,6 @@ static int axis_fifo_parse_dt(struct axis_fifo *fifo)
 
 static int axis_fifo_probe(struct platform_device *pdev)
 {
-	struct resource *r_mem;
 	struct device *dev = &pdev->dev;
 	struct axis_fifo *fifo = NULL;
 	int rc = 0; /* error return value */
@@ -447,7 +448,7 @@ static int axis_fifo_probe(struct platform_device *pdev)
 	mutex_init(&fifo->read_lock);
 	mutex_init(&fifo->write_lock);
 
-	fifo->base_addr = devm_platform_get_and_ioremap_resource(pdev, 0, &r_mem);
+	fifo->base_addr = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
 	if (IS_ERR(fifo->base_addr))
 		return PTR_ERR(fifo->base_addr);
 
-- 
2.56.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-10-23 13:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-22 21:53 [PATCH] staging: axis-fifo: Fix three real issues Breno Rodrigues Alves
2026-10-23  6:08 ` Greg Kroah-Hartman
2026-10-23  8:52   ` Breno Rodrigues Alves
2026-10-23  9:27     ` Dan Carpenter
2026-10-23 10:39   ` [PATCH v2] staging: axis-fifo: remove unused r_mem local variable Breno Rodrigues Alves
2026-10-23 10:44     ` Dan Carpenter
2026-10-23 13:31     ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®