Commit f89d2cc3 authored by Krishna Yarlagadda's avatar Krishna Yarlagadda Committed by Mark Brown

spi: tegra210-quad: use devm call for cdata memory

Use devm alloc call to allocate memory for spi controller data and
remove free calls from cleanup.
Signed-off-by: default avatarKrishna Yarlagadda <kyarlagadda@nvidia.com>
Link: https://lore.kernel.org/r/1637834152-32093-1-git-send-email-kyarlagadda@nvidia.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent f44a29ce
...@@ -877,7 +877,7 @@ static struct tegra_qspi_client_data *tegra_qspi_parse_cdata_dt(struct spi_devic ...@@ -877,7 +877,7 @@ static struct tegra_qspi_client_data *tegra_qspi_parse_cdata_dt(struct spi_devic
struct tegra_qspi_client_data *cdata; struct tegra_qspi_client_data *cdata;
struct device_node *slave_np = spi->dev.of_node; struct device_node *slave_np = spi->dev.of_node;
cdata = kzalloc(sizeof(*cdata), GFP_KERNEL); cdata = devm_kzalloc(&spi->dev, sizeof(*cdata), GFP_KERNEL);
if (!cdata) if (!cdata)
return NULL; return NULL;
...@@ -888,14 +888,6 @@ static struct tegra_qspi_client_data *tegra_qspi_parse_cdata_dt(struct spi_devic ...@@ -888,14 +888,6 @@ static struct tegra_qspi_client_data *tegra_qspi_parse_cdata_dt(struct spi_devic
return cdata; return cdata;
} }
static void tegra_qspi_cleanup(struct spi_device *spi)
{
struct tegra_qspi_client_data *cdata = spi->controller_data;
spi->controller_data = NULL;
kfree(cdata);
}
static int tegra_qspi_setup(struct spi_device *spi) static int tegra_qspi_setup(struct spi_device *spi)
{ {
struct tegra_qspi *tqspi = spi_master_get_devdata(spi->master); struct tegra_qspi *tqspi = spi_master_get_devdata(spi->master);
...@@ -1229,7 +1221,6 @@ static int tegra_qspi_probe(struct platform_device *pdev) ...@@ -1229,7 +1221,6 @@ static int tegra_qspi_probe(struct platform_device *pdev)
SPI_TX_DUAL | SPI_RX_DUAL | SPI_TX_QUAD | SPI_RX_QUAD; SPI_TX_DUAL | SPI_RX_DUAL | SPI_TX_QUAD | SPI_RX_QUAD;
master->bits_per_word_mask = SPI_BPW_MASK(32) | SPI_BPW_MASK(16) | SPI_BPW_MASK(8); master->bits_per_word_mask = SPI_BPW_MASK(32) | SPI_BPW_MASK(16) | SPI_BPW_MASK(8);
master->setup = tegra_qspi_setup; master->setup = tegra_qspi_setup;
master->cleanup = tegra_qspi_cleanup;
master->transfer_one_message = tegra_qspi_transfer_one_message; master->transfer_one_message = tegra_qspi_transfer_one_message;
master->num_chipselect = 1; master->num_chipselect = 1;
master->auto_runtime_pm = true; master->auto_runtime_pm = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment