Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dcccdd93 authored by Rene Herman's avatar Rene Herman Committed by Jaroslav Kysela
Browse files

[ALSA] unregister platform device again if probe was unsuccessful



Unregister the platform device again if the probe was unsuccessful.

This restores the behaviour of not loading the driver on probe() failure.

Signed-off-by: default avatarRene Herman <rene.herman@keyaccess.nl>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent d0ac642d
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -195,6 +195,10 @@ static int __init alsa_card_ad1848_init(void)
							 i, NULL, 0);
		if (IS_ERR(device))
			continue;
		if (!platform_get_drvdata(device)) {
			platform_device_unregister(device);
			continue;
		}
		devices[i] = device;
		cards++;
	}
+7 −4
Original line number Diff line number Diff line
@@ -43,8 +43,7 @@ static int __devinit snd_adlib_probe(struct platform_device *device)
	struct snd_card *card;
	struct snd_opl3 *opl3;

	int error;
	int i = device->id;
	int error, i = device->id;

	if (port[i] == SNDRV_AUTO_PORT) {
		snd_printk(KERN_ERR DRV_NAME ": please specify port\n");
@@ -95,8 +94,7 @@ static int __devinit snd_adlib_probe(struct platform_device *device)
	return 0;

out1:	snd_card_free(card);
 out0:	error = -EINVAL; /* FIXME: should be the original error code */
	return error;
out0:	return error;
}

static int __devexit snd_adlib_remove(struct platform_device *device)
@@ -134,6 +132,11 @@ static int __init alsa_card_adlib_init(void)
		if (IS_ERR(device))
			continue;

		if (!platform_get_drvdata(device)) {
			platform_device_unregister(device);
			continue;
		}

		devices[i] = device;
		cards++;
	}
+4 −0
Original line number Diff line number Diff line
@@ -701,6 +701,10 @@ static int __init alsa_card_cmi8330_init(void)
							 i, NULL, 0);
		if (IS_ERR(device))
			continue;
		if (!platform_get_drvdata(device)) {
			platform_device_unregister(device);
			continue;
		}
		platform_devices[i] = device;
		cards++;
	}
+4 −0
Original line number Diff line number Diff line
@@ -211,6 +211,10 @@ static int __init alsa_card_cs4231_init(void)
							 i, NULL, 0);
		if (IS_ERR(device))
			continue;
		if (!platform_get_drvdata(device)) {
			platform_device_unregister(device);
			continue;
		}
		devices[i] = device;
		cards++;
	}
+4 −0
Original line number Diff line number Diff line
@@ -782,6 +782,10 @@ static int __init alsa_card_cs423x_init(void)
							 i, NULL, 0);
		if (IS_ERR(device))
			continue;
		if (!platform_get_drvdata(device)) {
			platform_device_unregister(device);
			continue;
		}
		platform_devices[i] = device;
		snd_cs423x_devices++;
	}
Loading