diff options
| author | Gustavo Piaz da Silva <gustavopiazdasilva2102@gmail.com> | 2026-02-23 08:42:07 -0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-02-23 15:45:31 +0100 |
| commit | a8422facc2c8167d7bd72da99c8dc1ee3bfc181f (patch) | |
| tree | 2f22cf5a062d062a275f1cb099db2d61b1b28f0b | |
| parent | c2be939e93369568066554c37b222c4c309710c9 (diff) | |
staging: axis-fifo: refactor device tree parsing
Refactor the device tree parsing logic in axis_fifo_probe() to reduce
verbosity and simplify error handling.
Remove the verbose error logging and goto logic. Instead, check
of_property_read_u32() return values directly and propagate error codes
immediately. This aligns the driver with modern kernel standards by
removing unnecessary error messages during probe.
Signed-off-by: Gustavo Piaz da Silva <gustavopiazdasilva2102@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/20260223114207.3639-3-gustavopiazdasilva2102@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/staging/axis-fifo/axis-fifo.c | 55 |
1 files changed, 17 insertions, 38 deletions
diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c index e54bc4c1d40f..3aa2aa870ea9 100644 --- a/drivers/staging/axis-fifo/axis-fifo.c +++ b/drivers/staging/axis-fifo/axis-fifo.c @@ -392,60 +392,39 @@ static int axis_fifo_parse_dt(struct axis_fifo *fifo) ret = of_property_read_u32(node, "xlnx,axi-str-rxd-tdata-width", &value); - if (ret) { - dev_err(fifo->dt_device, "missing xlnx,axi-str-rxd-tdata-width property\n"); - goto end; - } else if (value != 32) { - dev_err(fifo->dt_device, "xlnx,axi-str-rxd-tdata-width only supports 32 bits\n"); - ret = -EIO; - goto end; - } + if (ret) + return ret; + if (value != 32) + return -EINVAL; ret = of_property_read_u32(node, "xlnx,axi-str-txd-tdata-width", &value); - if (ret) { - dev_err(fifo->dt_device, "missing xlnx,axi-str-txd-tdata-width property\n"); - goto end; - } else if (value != 32) { - dev_err(fifo->dt_device, "xlnx,axi-str-txd-tdata-width only supports 32 bits\n"); - ret = -EIO; - goto end; - } + if (ret) + return ret; + if (value != 32) + return -EINVAL; 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 (ret) + return ret; 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 (ret) + return ret; ret = of_property_read_u32(node, "xlnx,use-rx-data", &fifo->has_rx_fifo); - if (ret) { - dev_err(fifo->dt_device, "missing xlnx,use-rx-data property\n"); - ret = -EIO; - goto end; - } + if (ret) + return ret; ret = of_property_read_u32(node, "xlnx,use-tx-data", &fifo->has_tx_fifo); - if (ret) { - dev_err(fifo->dt_device, "missing xlnx,use-tx-data property\n"); - ret = -EIO; - goto end; - } + if (ret) + return ret; -end: - return ret; + return 0; } static int axis_fifo_probe(struct platform_device *pdev) |
