linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kukjin Kim <kgene.kim@samsung.com>
To: 'Sylwester Nawrocki' <s.nawrocki@samsung.com>,
	broonie@opensource.wolfsonmicro.com
Cc: thomas.abraham@linaro.org,
	spi-devel-general@lists.sourceforge.net,
	linux-samsung-soc@vger.kernel.org, sw0312.kim@samsung.com,
	'Kyungmin Park' <kyungmin.park@samsung.com>
Subject: RE: [PATCH] spi: s3c64xx: Don't free controller_data on non-dt platforms
Date: Fri, 14 Sep 2012 13:27:40 +0900	[thread overview]
Message-ID: <01a801cd9231$471c9240$d555b6c0$%kim@samsung.com> (raw)
In-Reply-To: <1347546690-21848-1-git-send-email-s.nawrocki@samsung.com>

Sylwester Nawrocki wrote:
> 
> When s3c64xx-spi is instantiated from device tree an instance of
> struct s3c64xx_spi_csinfo is dynamically allocated in the driver.
> For non-dt platform it is passed from board code through
> spi_register_board_info(). On error path in s3c64xx_spi_setup()
> function there is an attempt to free this data struct
> s3c64xx_spi_csinfo object as it would have been allocated in the
> driver for both, dt and non-dt based platforms. This leads to
> following bug when gpio request fails:
> 
> spi spi1.0: Failed to get /CS gpio [21]: -16
> kernel BUG at mm/slub.c:3478!
> Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
> Modules linked in:
> CPU: 0    Not tainted  (3.6.0-rc5-00092-g9b0b493-dirty #6111)
> PC is at kfree+0x148/0x158
> LR is at s3c64xx_spi_setup+0xac/0x290
> pc : [<c00a513c>]    lr : [<c0227014>]    psr: 40000013
> sp : ee043e10  ip : c032883c  fp : c0481f7c
> r10: ee0abd80  r9 : 00000063  r8 : 00000000
> r7 : ee129e78  r6 : ee104a00  r5 : fffffff0  r4 : c047bc64
> r3 : 40000400  r2 : c047bc64  r1 : c04def60  r0 : 0004047b
> Flags: nZcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
> Control: 10c5387d  Table: 4000404a  DAC: 00000015
> Process swapper/0 (pid: 1, stack limit = 0xee0422f0)
> Stack: (0xee043e10 to 0xee044000)
> ...
> [<c00a513c>] (kfree+0x148/0x158) from [<c0227014>]
> (s3c64xx_spi_setup+0xac/0x290)
> [<c0227014>] (s3c64xx_spi_setup+0xac/0x290) from [<c02251a4>]
> (spi_setup+0x34/0x4c)
> [<c02251a4>] (spi_setup+0x34/0x4c) from [<c02258d0>]
> (spi_add_device+0x98/0x128)
> [<c02258d0>] (spi_add_device+0x98/0x128) from [<c02259d4>]
> (spi_new_device+0x74/0xa8)
> [<c02259d4>] (spi_new_device+0x74/0xa8) from [<c0225a2c>]
> (spi_match_master_to_boardinfo+0x24/0x44)
> [<c0225a2c>] (spi_match_master_to_boardinfo+0x24/0x44) from [<c0225b40>]
> (spi_register_master+0xf4/0x2a8)
> [<c0225b40>] (spi_register_master+0xf4/0x2a8) from [<c043fe0c>]
> (s3c64xx_spi_probe+0x34c/0x42c)
> [<c043fe0c>] (s3c64xx_spi_probe+0x34c/0x42c) from [<c01fc198>]
> (platform_drv_probe+0x18/0x1c)
> 
> There should be no attempt to kfree controller_data when it was
> externally provided through the board code. Fix this by freeing
> controller_data only when dev->of_node is not null.
> 
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>

Yes, correct. Need to check it.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

  reply	other threads:[~2012-09-14  4:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-13 14:31 [PATCH] spi: s3c64xx: Don't free controller_data on non-dt platforms Sylwester Nawrocki
2012-09-14  4:27 ` Kukjin Kim [this message]
2012-09-22 16:12 ` Mark Brown

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='01a801cd9231$471c9240$d555b6c0$%kim@samsung.com' \
    --to=kgene.kim@samsung.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=s.nawrocki@samsung.com \
    --cc=spi-devel-general@lists.sourceforge.net \
    --cc=sw0312.kim@samsung.com \
    --cc=thomas.abraham@linaro.org \
    /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;
as well as URLs for NNTP newsgroup(s).