From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from quartz.orcorp.ca ([184.70.90.242]:36954 "EHLO quartz.orcorp.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752596AbdGIVL4 (ORCPT ); Sun, 9 Jul 2017 17:11:56 -0400 Date: Sun, 9 Jul 2017 15:11:50 -0600 From: Jason Gunthorpe To: Alexander Steffen Cc: tpmdd-devel@lists.sourceforge.net, stable@vger.kernel.org Subject: Re: [tpmdd-devel] [PATCH] tpm_tis_spi: Use DMA-safe memory for SPI transfers Message-ID: <20170709211150.GA19327@obsidianresearch.com> References: <20170704135609.5064-1-Alexander.Steffen@infineon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170704135609.5064-1-Alexander.Steffen@infineon.com> Sender: stable-owner@vger.kernel.org List-ID: On Tue, Jul 04, 2017 at 03:56:09PM +0200, Alexander Steffen wrote: > struct tpm_tis_spi_phy { > struct tpm_tis_data priv; > struct spi_device *spi_device; > - > - u8 tx_buf[4]; > - u8 rx_buf[4]; > + u8 *iobuf; tpm_tis_spi_phy is already devm_kzalloc'd, why embed another kalloc pointer inside it? > + phy->iobuf = devm_kmalloc(&dev->dev, MAX_SPI_FRAMESIZE, GFP_KERNEL); > + if (!phy->iobuf) > + return -ENOMEM; Just do: struct tpm_tis_spi_phy { struct tpm_tis_data priv; struct spi_device *spi_device; u64 iobuf[MAX_SPI_FRAMESIZE/8]; Jason