From: Sean Anderson Date: Thu, 2 Apr 2020 08:32:05 -0400 Subject: [PATCH v1 4/8] spi: dw: Use generic function to read reg address In-Reply-To: References: <20200305191925.959494-1-seanga2@gmail.com> <20200305191925.959494-5-seanga2@gmail.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 4/2/20 8:24 AM, Jagan Teki wrote: > On Fri, Mar 6, 2020 at 12:49 AM Sean Anderson wrote: >> >> Using an fdt-specific function causes problems when compiled with a live >> tree. >> >> Signed-off-by: Sean Anderson >> --- >> >> drivers/spi/designware_spi.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/spi/designware_spi.c b/drivers/spi/designware_spi.c >> index 765fa2f582..38c24fe550 100644 >> --- a/drivers/spi/designware_spi.c >> +++ b/drivers/spi/designware_spi.c >> @@ -161,7 +161,9 @@ static int dw_spi_ofdata_to_platdata(struct udevice *bus) >> { >> struct dw_spi_platdata *plat = bus->platdata; >> >> - plat->regs = (struct dw_spi *)devfdt_get_addr(bus); >> + plat->regs = dev_read_addr_ptr(bus); >> + if (!plat->regs) >> + return -EINVAL; > > Better check the returned regs with FDT_ADDR_T_NONE > This series depends on the series for k210 support which includes the patch "dm: Fix error handling for dev_read_addr_ptr" [1]. This patch changes the semantics for that function to be consistent regardless of whether a live device tree is in use. [1] https://patchwork.ozlabs.org/patch/1258450/ --Sean