From: Greg KH <gregkh@linuxfoundation.org>
To: srinivas.kandagatla@linaro.org
Cc: linux-kernel@vger.kernel.org,
Masahiro Yamada <yamada.masahiro@socionext.com>
Subject: Re: [PATCH 01/12] nvmem: imx-iim: use stack for nvmem_config instead of malloc'ing it
Date: Fri, 20 Oct 2017 15:32:20 +0200 [thread overview]
Message-ID: <20171020133220.GA9301@kroah.com> (raw)
In-Reply-To: <20171009132641.27169-2-srinivas.kandagatla@linaro.org>
On Mon, Oct 09, 2017 at 03:26:30PM +0200, srinivas.kandagatla@linaro.org wrote:
> From: Masahiro Yamada <yamada.masahiro@socionext.com>
>
> nvmem_register() copies all the members of nvmem_config to
> nvmem_device. So, nvmem_config is one-time use data during
> probing. There is no point to keep it until the driver detach.
> Using stack should be no problem because nvmem_config is pretty
> small.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
> drivers/nvmem/imx-iim.c | 27 ++++++++++++---------------
> 1 file changed, 12 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/nvmem/imx-iim.c b/drivers/nvmem/imx-iim.c
> index 52ff65e0673f..a5992602709a 100644
> --- a/drivers/nvmem/imx-iim.c
> +++ b/drivers/nvmem/imx-iim.c
> @@ -34,7 +34,6 @@ struct imx_iim_drvdata {
> struct iim_priv {
> void __iomem *base;
> struct clk *clk;
> - struct nvmem_config nvmem;
> };
>
> static int imx_iim_read(void *context, unsigned int offset,
> @@ -108,7 +107,7 @@ static int imx_iim_probe(struct platform_device *pdev)
> struct resource *res;
> struct iim_priv *iim;
> struct nvmem_device *nvmem;
> - struct nvmem_config *cfg;
> + struct nvmem_config cfg = {};
You do realize you are now not zeroing out this structure, and have to
explicitly initialize all of the fields, right?
What is the real problem with doing a dynamic allocation for this?
Putting structures on the stack is a "bad idea" for all of the obvious
reasons (small stack in the kernel, initialized data, lower layers
expect it to be dma-able, etc.)
thanks,
greg k-h
next prev parent reply other threads:[~2017-10-20 13:32 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-09 13:26 [PATCH 00/12] nvmem: patches set-1 for v4.15 srinivas.kandagatla
2017-10-09 13:26 ` [PATCH 01/12] nvmem: imx-iim: use stack for nvmem_config instead of malloc'ing it srinivas.kandagatla
2017-10-20 13:32 ` Greg KH [this message]
2017-10-20 13:47 ` Masahiro Yamada
2017-10-20 13:54 ` Greg KH
2017-10-20 14:26 ` Masahiro Yamada
2017-10-20 14:47 ` Greg KH
2017-10-20 16:18 ` Masahiro Yamada
2017-10-20 16:26 ` Greg KH
2017-10-30 15:55 ` Masahiro Yamada
2017-10-09 13:26 ` [PATCH 02/12] nvmem: mtk-efuse: " srinivas.kandagatla
2017-10-20 13:34 ` Greg KH
2017-10-20 13:47 ` Masahiro Yamada
2017-10-20 13:54 ` Greg KH
2017-10-20 13:59 ` Masahiro Yamada
2017-10-20 14:48 ` Greg KH
2017-10-09 13:26 ` [PATCH 03/12] nvmem: mtk-efuse: fix different address space warnings of sparse srinivas.kandagatla
2017-10-20 13:34 ` Greg KH
2017-10-20 13:55 ` Masahiro Yamada
2017-10-20 14:49 ` Greg KH
2017-10-20 16:08 ` Masahiro Yamada
2017-10-09 13:26 ` [PATCH 04/12] nvmem: qfprom: " srinivas.kandagatla
2017-10-20 13:34 ` Greg KH
2017-10-09 13:26 ` [PATCH 05/12] nvmem: set nvmem->owner to nvmem->dev->driver->owner if unset srinivas.kandagatla
2017-10-20 13:38 ` Greg KH
2017-10-20 13:44 ` Srinivas Kandagatla
2017-10-20 13:52 ` Greg KH
2017-10-09 13:26 ` [PATCH 06/12] nvmem: sunxi-sid: add support for A64/H5's SID controller srinivas.kandagatla
2017-10-20 13:36 ` Greg KH
2017-10-09 13:26 ` [PATCH 07/12] dt-bindings: nvmem: add description for UniPhier eFuse srinivas.kandagatla
2017-10-20 13:36 ` Greg KH
2017-10-09 13:26 ` [PATCH 08/12] nvmem: uniphier: add UniPhier eFuse driver srinivas.kandagatla
2017-10-20 13:37 ` Greg KH
2017-10-09 13:26 ` [PATCH 09/12] nvmem: rockchip: add support for RK3368 srinivas.kandagatla
2017-10-09 13:26 ` [PATCH 10/12] dt-bindings: nvmem: Describe the Amlogic Meson6/Meson8/Meson8b efuse srinivas.kandagatla
2017-10-12 20:52 ` Martin Blumenstingl
2017-10-09 13:26 ` [PATCH 11/12] nvmem: meson-efuse: indicate that this driver is only for Meson GX SoCs srinivas.kandagatla
2017-10-12 20:51 ` Martin Blumenstingl
2017-10-09 13:26 ` [PATCH 12/12] nvmem: add a driver for the Amlogic Meson6/Meson8/Meson8b SoCs srinivas.kandagatla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171020133220.GA9301@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=srinivas.kandagatla@linaro.org \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.