mmc: dw_mmc: Don't copy struct device; keep a pointer
authorDoug Anderson <dianders@chromium.org>
Mon, 17 Sep 2012 22:47:59 +0000 (15:47 -0700)
committerGerrit <chrome-bot@google.com>
Tue, 18 Sep 2012 01:06:32 +0000 (18:06 -0700)
commitbf5da6ca68cbc7c82b49b0bea9a91363d917bc1e
treeea307c80d87bd9fdbb003ba3c920ff61935e9371
parent67624b8ae24175a3b51429c55c813531e118de4e
mmc: dw_mmc: Don't copy struct device; keep a pointer

It's not such a good idea to make a copy of your 'struct device'.
This was specifically causing a warning when you turn on list
debugging but was just generally bad voodoo:

  [    2.876227] ------------[ cut here ]------------
  [    2.880813] WARNING: at .../lib/list_debug.c:32 __list_add+0x64/0x88()
  [    2.891308] list_add corruption. prev->next should be next (eddded18), but was ef2ef5e0. (prev=ef2ef5e0).
  [    2.900855] Modules linked in:
  [    2.903904] [<80015960>] (unwind_backtrace+0x0/0xec) from [<804f5c94>] (dump_stack+0x20/0x24)
  [    2.912406] [<804f5c94>] (dump_stack+0x20/0x24) from [<8002a7ac>] (warn_slowpath_common+0x5c/0x74)
  [    2.921345] [<8002a7ac>] (warn_slowpath_common+0x5c/0x74) from [<8002a880>] (warn_slowpath_fmt+0x40/0x48)
  [    2.930893] [<8002a880>] (warn_slowpath_fmt+0x40/0x48) from [<80234f14>] (__list_add+0x64/0x88)
  [    2.939575] [<80234f14>] (__list_add+0x64/0x88) from [<802cae08>] (add_dr+0x78/0x90)
  [    2.947297] [<802cae08>] (add_dr+0x78/0x90) from [<802cb02c>] (devres_add+0x38/0x48)
  [    2.955021] [<802cb02c>] (devres_add+0x38/0x48) from [<802cb0b0>] (devm_kzalloc+0x74/0x84)
  [    2.963269] [<802cb0b0>] (devm_kzalloc+0x74/0x84) from [<803c85a4>] (dw_mci_probe+0x40/0xd74)
  [    2.971775] [<803c85a4>] (dw_mci_probe+0x40/0xd74) from [<803ca1cc>] (dw_mci_pltfm_probe+0xdc/0x11c)
  [    2.980889] [<803ca1cc>] (dw_mci_pltfm_probe+0xdc/0x11c) from [<802c9544>] (platform_drv_probe+0x24/0x28)
  [    2.990438] [<802c9544>] (platform_drv_probe+0x24/0x28) from [<802c8114>] (driver_probe_device+0xd8/0x210)
  [    3.000072] [<802c8114>] (driver_probe_device+0xd8/0x210) from [<802c82bc>] (__driver_attach+0x70/0x94)
  [    3.009446] [<802c82bc>] (__driver_attach+0x70/0x94) from [<802c6798>] (bus_for_each_dev+0x60/0x9c)
  [    3.018473] [<802c6798>] (bus_for_each_dev+0x60/0x9c) from [<802c7bf0>] (driver_attach+0x28/0x30)
  [    3.027327] [<802c7bf0>] (driver_attach+0x28/0x30) from [<802c7770>] (bus_add_driver+0xc0/0x23c)
  [    3.036094] [<802c7770>] (bus_add_driver+0xc0/0x23c) from [<802c8818>] (driver_register+0xac/0x138)
  [    3.045121] [<802c8818>] (driver_register+0xac/0x138) from [<802c9860>] (platform_driver_register+0x54/0x68)
  [    3.054930] [<802c9860>] (platform_driver_register+0x54/0x68) from [<802c989c>] (platform_driver_probe+0x28/0x9c)
  [    3.065174] [<802c989c>] (platform_driver_probe+0x28/0x9c) from [<8071eb14>] (dw_mci_init+0x18/0x24)
  [    3.074286] [<8071eb14>] (dw_mci_init+0x18/0x24) from [<8000869c>] (do_one_initcall+0xa0/0x170)
  [    3.082966] [<8000869c>] (do_one_initcall+0xa0/0x170) from [<80701a58>] (kernel_init+0xf8/0x1b4)
  [    3.091734] [<80701a58>] (kernel_init+0xf8/0x1b4) from [<8000f220>] (kernel_thread_exit+0x0/0x8)
  [    3.100505] ---[ end trace 21375439ea8d120e ]---

BUG=chrome-os-partner:13946
TEST=Booted; can use WiFi.

Change-Id: I4338bcf488096eb9fdcd395337fd60982a23d9c5
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/33461
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
Reviewed-by: Pawel Osciak <posciak@google.com>
drivers/mmc/host/dw_mmc-pci.c
drivers/mmc/host/dw_mmc-pltfm.c
drivers/mmc/host/dw_mmc.c
include/linux/mmc/dw_mmc.h