Re: [PATCH 1/1] spi: fsl-dspi: Fixes warning due to devm_kzalloc on unbound device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 04, 2014 at 09:09:15PM +0100, Mirza Krak wrote:

> ------------[ cut here ]------------
> WARNING: at drivers/base/dd.c:286 driver_probe_device+0x1b4/0x22c()
> Modules linked in:
> Backtrace:

Please don't paste entire backtraces into commit messages, they're large
and make it hard to find the content - if one  is useful please paste
the relevant portions only.

> Inspired by: 10aa5a35e34f ("SPI: fix over-eager devm_xxx()
> conversion")
> 
> Signed-off-by: Mirza Krak <mirza.krak@xxxxxxxxxxxxxxxx>

Your commit message should describe what the problem was and how it is
being fixed (ie, describe the change) rather than simply stating that it
is fixing an issue unless the change is really obvious.

> @@ -342,7 +342,7 @@ static int dspi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
>  	/* Only alloc on first setup */
>  	chip = spi_get_ctldata(spi);
>  	if (chip == NULL) {
> -		chip = devm_kzalloc(&spi->dev, sizeof(struct chip_data),
> +		chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL);
>  				    GFP_KERNEL);
>  		if (!chip)
>  			return -ENOMEM;

This is good.

> @@ -382,6 +382,11 @@ static int dspi_setup(struct spi_device *spi)
>  	return dspi_setup_transfer(spi, NULL);
>  }
>  
> +static void dspi_cleanup(struct spi_device *spi)
> +{
> +	spi_bitbang_cleanup(spi);
> +}
> +
>  static irqreturn_t dspi_interrupt(int irq, void *dev_id)
>  {
>  	struct fsl_dspi *dspi = (struct fsl_dspi *)dev_id;
> @@ -465,6 +470,7 @@ static int dspi_probe(struct platform_device *pdev)
>  	dspi->bitbang.setup_transfer = dspi_setup_transfer;
>  	dspi->bitbang.txrx_bufs = dspi_txrx_transfer;
>  	dspi->bitbang.master->setup = dspi_setup;
> +	dspi->bitbang.master->cleanup = dspi_cleanup;
>  	dspi->bitbang.master->dev.of_node = pdev->dev.of_node;

Why not just assign spi_bitbang_cleanup() directly?

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux