Re: [PATCH v4 2/2] staging: axis-fifo: refactor device tree parsing

From: Greg KH

Date: Mon Feb 02 2026 - 08:37:12 EST


On Mon, Feb 02, 2026 at 09:23:17AM -0300, Gustavo Piaz da Silva wrote:
> Refactor the device tree parsing logic in axis_fifo_probe() to reduce
> code duplication and improve readability.
>
> Create a helper function axis_fifo_get_u32() to handle property reading
> and error checking, replacing repetitive of_property_read_u32() calls.
>
> This eliminates the goto logic for error handling in the probe path and
> consolidates error logging.
>
> Signed-off-by: Gustavo Piaz da Silva <gustavopiazdasilva2102@xxxxxxxxx>
>
> Changes in v4:
> - Removed extra blank lines in the commit message.
> - Added "rx" and "tx" prefixes to error messages to distinguish between read and write width failures.
>
> Changes in v3:
> - Split the original v2 patch into two separate patches.
> drivers/staging/axis-fifo/axis-fifo.c | 77 +++++++++------------------
> 1 file changed, 25 insertions(+), 52 deletions(-)

You are missing a --- line after the signed-off-by :(

> +static int axis_fifo_parse_dt(struct axis_fifo *fifo)
> +{
> + u32 width;
>
> - ret = of_property_read_u32(node, "xlnx,rx-fifo-depth",
> - &fifo->rx_fifo_depth);
> - if (ret) {
> - dev_err(fifo->dt_device, "missing xlnx,rx-fifo-depth property\n");
> - ret = -EIO;
> - goto end;
> + if (axis_fifo_get_u32(fifo, "xlnx,axi-str-rxd-tdata-width", &width) || width != 32) {
> + dev_err(fifo->dt_device, "rx tdata-width only supports 32 bits\n");
> + return -EIO;
> }
> -
> - ret = of_property_read_u32(node, "xlnx,tx-fifo-depth",
> - &fifo->tx_fifo_depth);
> - if (ret) {
> - dev_err(fifo->dt_device, "missing xlnx,tx-fifo-depth property\n");
> - ret = -EIO;
> - goto end;
> + if (axis_fifo_get_u32(fifo, "xlnx,axi-str-txd-tdata-width", &width) || width != 32) {
> + dev_err(fifo->dt_device, "tx tdata-width only supports 32 bits\n");

Now you have 2 errors printed out?

And really, the helper function isn't needed, just get rid of the
dev_err() lines, why would they be needed anymore? No other driver uses
this type of error reporting that I have noticed.

Also, do you have this hardware to test this with?

thanks,

greg k-h