From: Brian Norris <computersforpeace@gmail.com>
To: Wei Yongjun <weiyj.lk@gmail.com>
Cc: artem.bityutskiy@linux.intel.com, jg1.han@samsung.com,
linux-kernel@vger.kernel.org, yongjun_wei@trendmicro.com.cn,
wfp5p@virginia.edu, linux-mtd@lists.infradead.org,
dwmw2@infradead.org
Subject: Re: [PATCH] MIPS: Alchemy: add missing platform_set_drvdata() in au1550nd_probe()
Date: Tue, 26 Nov 2013 15:50:26 -0800 [thread overview]
Message-ID: <20131126235026.GN9468@ld-irv-0074.broadcom.com> (raw)
In-Reply-To: <CAPgLHd-qf8Zj0gWgJh3_WMZOAx5-H6aABrVFqRsAw=XkOfDdmw@mail.gmail.com>
On Mon, Nov 11, 2013 at 02:18:29PM +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Add missing platform_set_drvdata() in au1550nd_probe(), otherwise
> calling platform_get_drvdata() in remove returns NULL.
An alternative solution: just allocate ctx with devm_kzalloc(). Then you
don't have to kfree() it at all.
I don't mind one solution over the other too much. Let me know which
you'd prefer.
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
> drivers/mtd/nand/au1550nd.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/mtd/nand/au1550nd.c b/drivers/mtd/nand/au1550nd.c
> index ae8dd7c..909b673 100644
> --- a/drivers/mtd/nand/au1550nd.c
> +++ b/drivers/mtd/nand/au1550nd.c
> @@ -480,6 +480,8 @@ static int au1550nd_probe(struct platform_device *pdev)
>
> mtd_device_register(&ctx->info, pd->parts, pd->num_parts);
>
> + platform_set_drvdata(pdev, ctx);
> +
Personally, I'd choose to call platform_set_drvdata() earlier in the
probe routine (e.g., immediately after its allocation), in case we end
up calling platform_get_drvdata() from some sub-routine in the future.
> return 0;
>
> out3:
>
Brian
next prev parent reply other threads:[~2013-11-26 23:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-11 6:18 [PATCH] MIPS: Alchemy: add missing platform_set_drvdata() in au1550nd_probe() Wei Yongjun
2013-11-26 23:50 ` Brian Norris [this message]
2013-11-27 0:14 ` Jingoo Han
2013-11-27 3:35 ` Brian Norris
2013-12-17 8:21 ` Brian Norris
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=20131126235026.GN9468@ld-irv-0074.broadcom.com \
--to=computersforpeace@gmail.com \
--cc=artem.bityutskiy@linux.intel.com \
--cc=dwmw2@infradead.org \
--cc=jg1.han@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=weiyj.lk@gmail.com \
--cc=wfp5p@virginia.edu \
--cc=yongjun_wei@trendmicro.com.cn \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox