diff mbox series

[2/5] spi: tegra210-quad: Fix duplicate resource error

Message ID 20221001122148.9158-2-kyarlagadda@nvidia.com (mailing list archive)
State Accepted
Commit 2197aa6b0aa236b9896a09b9d08d6924d18b84f6
Headers show
Series [1/5] spi: tegra210-quad: Fix combined sequence | expand

Commit Message

Krishna Yarlagadda Oct. 1, 2022, 12:21 p.m. UTC
controller data alloc is done with client device data causing duplicate
resource error. Allocate memory using controller device when using devm

Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
---
 drivers/spi/spi-tegra210-quad.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jon Hunter Nov. 11, 2022, 9:49 a.m. UTC | #1
On 01/10/2022 13:21, Krishna Yarlagadda wrote:
> controller data alloc is done with client device data causing duplicate
> resource error. Allocate memory using controller device when using devm
> 
> Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
> ---
>   drivers/spi/spi-tegra210-quad.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/spi-tegra210-quad.c b/drivers/spi/spi-tegra210-quad.c
> index 904972606bd4..06bf19d0cfc1 100644
> --- a/drivers/spi/spi-tegra210-quad.c
> +++ b/drivers/spi/spi-tegra210-quad.c
> @@ -918,8 +918,9 @@ static int tegra_qspi_start_transfer_one(struct spi_device *spi,
>   static struct tegra_qspi_client_data *tegra_qspi_parse_cdata_dt(struct spi_device *spi)
>   {
>   	struct tegra_qspi_client_data *cdata;
> +	struct tegra_qspi *tqspi = spi_master_get_devdata(spi->master);
>   
> -	cdata = devm_kzalloc(&spi->dev, sizeof(*cdata), GFP_KERNEL);
> +	cdata = devm_kzalloc(tqspi->dev, sizeof(*cdata), GFP_KERNEL);
>   	if (!cdata)
>   		return NULL;
>   


This fixes the following error I have been observing ...

  CRIT KERN spi spi0.0: Resources present before probing

Krishna, can you resend this with the following fixes tag?

Fixes: f89d2cc3967a ("spi: tegra210-quad: use devm call for cdata memory")

May be worth sending this separately from the reset of the series if 
that still needs work. Also, it could be worth indicating that this 
fixes the above error that we are observing and that the wrong device 
was being used for devm. Otherwise ...

Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>

Jon
diff mbox series

Patch

diff --git a/drivers/spi/spi-tegra210-quad.c b/drivers/spi/spi-tegra210-quad.c
index 904972606bd4..06bf19d0cfc1 100644
--- a/drivers/spi/spi-tegra210-quad.c
+++ b/drivers/spi/spi-tegra210-quad.c
@@ -918,8 +918,9 @@  static int tegra_qspi_start_transfer_one(struct spi_device *spi,
 static struct tegra_qspi_client_data *tegra_qspi_parse_cdata_dt(struct spi_device *spi)
 {
 	struct tegra_qspi_client_data *cdata;
+	struct tegra_qspi *tqspi = spi_master_get_devdata(spi->master);
 
-	cdata = devm_kzalloc(&spi->dev, sizeof(*cdata), GFP_KERNEL);
+	cdata = devm_kzalloc(tqspi->dev, sizeof(*cdata), GFP_KERNEL);
 	if (!cdata)
 		return NULL;