Skip to content

Commit

Permalink
[ALSA] sound: fix incorrect use of platform_device_register()
Browse files Browse the repository at this point in the history
The platform_device allocated by platform_device_alloc()
should be added to the device hierarchy by platform_device_add()
instead of platform_device_register().
Otherwise it will hit WARN_ON() in platform_device_register().
by illegal refcount.
This patch fixes such incorrect usages in portman2x4 and mts64 drivers.
Also it removes unnecessary trailing whitespaces.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
  • Loading branch information
mita authored and Jaroslav Kysela committed May 11, 2007
1 parent 9422db4 commit 479ef43
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions sound/drivers/mts64.c
Original file line number Diff line number Diff line change
Expand Up @@ -892,13 +892,13 @@ static void __devinit snd_mts64_attach(struct parport *p)
struct platform_device *device;

device = platform_device_alloc(PLATFORM_DRIVER, device_count);
if (!device)
if (!device)
return;

/* Temporary assignment to forward the parport */
platform_set_drvdata(device, p);

if (platform_device_register(device) < 0) {
if (platform_device_add(device) < 0) {
platform_device_put(device);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions sound/drivers/portman2x4.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,13 +676,13 @@ static void __devinit snd_portman_attach(struct parport *p)
struct platform_device *device;

device = platform_device_alloc(PLATFORM_DRIVER, device_count);
if (!device)
if (!device)
return;

/* Temporary assignment to forward the parport */
platform_set_drvdata(device, p);

if (platform_device_register(device) < 0) {
if (platform_device_add(device) < 0) {
platform_device_put(device);
return;
}
Expand Down

0 comments on commit 479ef43

Please sign in to comment.