From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8446A258CD9 for ; Mon, 2 Feb 2026 08:32:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770021136; cv=none; b=KFDEkteDzWJ9/RYyV/X2rTfzeJGNKKYWIYHKzH7JwrCFGeZJFY/Tzo0qMDjLXpTyse6mnMkyNwCk4ZbXjnUASY1a2DrAEHOR90yqYJVrNfK1x532xmyMySViBSkk74I2MxigZLISXfulUTbZJ34v8dZF+G366vIUJYau5r04zpE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770021136; c=relaxed/simple; bh=Tyo8zNs3p7vI0rMC9xc0QfcF/mQHauzf0txKo94Sbcg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uWPdfi4kbsstJy9DR4O7dU7aTdVJcMczJ4Og8VpKCQUG35Kq9sw/elj8KYo0FJtI/WRiQ/lt3W051UoBUpoVWMNRXBX2lmha2S1KPiS0YhjXqGZeMvwiheHYJsSehnm/bAXKUiS3R+e3ymkNYSsHQ1WO1EtLma2dgWXrUM+K/h0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Z4VmVNq2; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Z4VmVNq2" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-430f3ef2d37so3571022f8f.3 for ; Mon, 02 Feb 2026 00:32:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1770021133; x=1770625933; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=bNdO11u8Moy78UisAklN4GF/yvopyhw93XwMUNoLOG8=; b=Z4VmVNq2kJAnrfeai81LVkQIXcy0H3jW89r3zOeU6mzBpoHZlL88JIVbMqoeRE/55e QHM7wI3iG/L/VPp0EIz76s6dgcEvGN1CfJbU6WDB98Ep24lQwvpmHHE/iD5btQ72oOmY ttx0Gygpv/jwV4gYTakSVUlM9QNAJGREwSD/u1PTWSZaK8UCfCuMTE8+l2abgpSqAvUt mmHKkLHOZ8j9VIJt6GhqM2PHIj+8PyH6guJwtVw0njqDJ5f7n/GO8GlNiclYlyUaROVJ 3WW2kUYe+a70GWHQAJCLFezOWjJaC1C3sh8uf0NiQidovi2LNtcJ12zM3gA3VE4IAJJ4 BxTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770021133; x=1770625933; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bNdO11u8Moy78UisAklN4GF/yvopyhw93XwMUNoLOG8=; b=M5I2v4RlbFCMWjTx2jL6JAWBgYr530JVSostidXUBfxaBT1feBPvEnXvN99VAj01u/ fjs6RlVG+FhgcvTWjTQsEO2PGpPhllgKafMB1JqXG/0iUedwNNIY8YpQ+BNKzEP3vlDU +gY7TsdmN+NoJIivM3VUCRtlCQjwHHSyKeiLM9a9DLB3+3txPgGKVDrU1twgXhevtFdr Xo7tkdy0uG6eojJV8gIX499mo4zZoGycf6Q4jTR0chTVeEVLXYupOl7K/cQsgWvXe/oc 74qyFgB7pgycPreOjglowfyj8/0yDku0Juot92kl8XsL7TKnZcCBeq5nQ/LMoP5mfLPk E4Lw== X-Forwarded-Encrypted: i=1; AJvYcCVzj9sJLX8eeFiMNhPPL9Wobi0Xu/BaP4LxuiFW0ehbSalphsTZi9ORTZWsYCmMp3rYdrNVJL8hpTOjN/0=@vger.kernel.org X-Gm-Message-State: AOJu0YzRAC1kgCKkOpRy2bVnQC1iVZrOog9BWPaNsqqb7NJ7OTJM6GYg /xfIkiBQH3AqMPxVmTGSPzqPq963fvgWDGeWQBRZ4cllVZG0zcZFsKDG30EUL/2XmVo= X-Gm-Gg: AZuq6aJP+JwRMJB7VR1Lxs5jSyeMp5Yt916DayKf1X7ApPmU/pkM/UOUhCFb9dHeaA/ oAVIdGiuYKex2WE5HHSmXIJPRcUfUHvABfN7Gzri+I/0iKckmrb5zD3SFltDmntOU9IpNsmt2Bb bnssWaHXcRSGFVYy/9sFBt8VU/2bCe23Wb9kjDfjhJs1AgT4Ssmumo/2k14ZSWFqV+iNylUdY2y q7vsEFYzhEOndyGXK2gB6a8smZ92j9uCzhrEoUS9idet+EvNCDkZO1IL4Pg+vgnEljkDWjsHbqB F/IkXMr6Rb+Qr022TkxaA5YyE2FnpL1odLL/WhxBrrPRdU1Bz/PyaeVmGNZWXu7pIPBir2XDzMk ieLh1gm2cGL3B15p/6zD2NqlZ4W5Ga1hHYWcSiF8I4+RyG9A5GuS/WvqVXRj8e512p3VTVUuCZ7 3a6V8oJwSH4JsM/0ns X-Received: by 2002:a5d:5885:0:b0:430:f7dc:7e96 with SMTP id ffacd0b85a97d-435f3aac755mr15572987f8f.48.1770021132699; Mon, 02 Feb 2026 00:32:12 -0800 (PST) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435e10ed952sm43510312f8f.10.2026.02.02.00.32.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Feb 2026 00:32:12 -0800 (PST) Date: Mon, 2 Feb 2026 11:32:08 +0300 From: Dan Carpenter To: Gustavo Piaz da Silva Cc: gregkh@linuxfoundation.org, ovidiu.panait.oss@gmail.com, gshahrouzi@gmail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/2] staging: axis-fifo: refactor device tree parsing Message-ID: References: <20260131182732.62857-1-gustavopiazdasilva2102@gmail.com> <20260131182732.62857-3-gustavopiazdasilva2102@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260131182732.62857-3-gustavopiazdasilva2102@gmail.com> On Sat, Jan 31, 2026 at 03:27:32PM -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. > Delete the extra blank lines. > Signed-off-by: Gustavo Piaz da Silva > --- No changelog explaining what changed vs v2. > drivers/staging/axis-fifo/axis-fifo.c | 76 +++++++++------------------ > 1 file changed, 25 insertions(+), 51 deletions(-) > > diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c > index 7bc7bf191250..1e3059ec4fbd 100644 > --- a/drivers/staging/axis-fifo/axis-fifo.c > +++ b/drivers/staging/axis-fifo/axis-fifo.c > @@ -482,68 +482,42 @@ static void axis_fifo_debugfs_init(struct axis_fifo *fifo) > &axis_fifo_debugfs_regs_fops); > } > > -static int axis_fifo_parse_dt(struct axis_fifo *fifo) > + > +static int axis_fifo_get_u32(struct axis_fifo *fifo, const char *prop, u32 *val) > { > - int ret; > - unsigned int value; > - struct device_node *node = fifo->dt_device->of_node; > + int ret = of_property_read_u32(fifo->dt_device->of_node, prop, val); > > - 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; > + dev_err(fifo->dt_device, "missing %s property\n", prop); > + return ret; > } > + return 0; > +} > > - 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; > - } > +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, "tdata-width only supports 32 bits\n"); Better to put "rx" in the error message > + 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, "tdata-width only supports 32 bits\n"); and "tx" here. regards, dan carpenter > + return -EIO; > }