Re: [PATCH 1/2] Add support for Cadence XSPI controller

From: Lukas Wunner
Date: Sat Dec 12 2020 - 07:19:47 EST


On Wed, Dec 09, 2020 at 08:57:57AM +0100, Jayshri Pawar wrote:
> + master = spi_alloc_master(dev, sizeof(*cdns_xspi));
> + if (!master) {
> + ret = -ENOMEM;
> + dev_err(dev, "Failed to allocate memory for spi_master\n");
> + goto err_no_mem;
> + }

Please use devm_spi_alloc_master() to simplify the probe error path.
It was introduced in v5.10-rc5 with commit 5e844cc37a5c and is also
available in 5.9-stable and 5.4-stable.

The memory allocater already emits an error message if it can't satisfy
a request. Emitting an additional message here isn't really necessary.


> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + cdns_xspi->iobase = devm_ioremap_resource(cdns_xspi->dev, res);
> + if (IS_ERR(cdns_xspi->iobase)) {
> + ret = PTR_ERR(cdns_xspi->iobase);
> + dev_err(dev, "Failed to remap controller base address\n");
> + goto err_spi_master;
> + }

Please use devm_platform_ioremap_resource().

Thanks,

Lukas