From 59feddb25f9d925e86ee22596802405788bc050f Mon Sep 17 00:00:00 2001 From: Panagiotis Issaris Date: Tue, 25 Jul 2006 15:28:03 +0200 Subject: [ALSA] Conversions from kmalloc+memset to k(z|c)alloc sound: Conversions from kmalloc+memset to k(c|z)alloc. Signed-off-by: Panagiotis Issaris Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- sound/ppc/awacs.c | 3 +-- sound/ppc/daca.c | 3 +-- sound/ppc/keywest.c | 3 +-- sound/ppc/tumbler.c | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) (limited to 'sound/ppc') diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c index 82d791be7499..05dabe454658 100644 --- a/sound/ppc/awacs.c +++ b/sound/ppc/awacs.c @@ -801,11 +801,10 @@ snd_pmac_awacs_init(struct snd_pmac *chip) chip->revision = (in_le32(&chip->awacs->codec_stat) >> 12) & 0xf; #ifdef PMAC_AMP_AVAIL if (chip->revision == 3 && chip->has_iic && CHECK_CUDA_AMP()) { - struct awacs_amp *amp = kmalloc(sizeof(*amp), GFP_KERNEL); + struct awacs_amp *amp = kzalloc(sizeof(*amp), GFP_KERNEL); if (! amp) return -ENOMEM; chip->mixer_data = amp; - memset(amp, 0, sizeof(*amp)); chip->mixer_free = awacs_amp_free; awacs_amp_set_vol(amp, 0, 63, 63, 0); /* mute and zero vol */ awacs_amp_set_vol(amp, 1, 63, 63, 0); diff --git a/sound/ppc/daca.c b/sound/ppc/daca.c index 46eebf5610e3..57202b0f033e 100644 --- a/sound/ppc/daca.c +++ b/sound/ppc/daca.c @@ -258,10 +258,9 @@ int __init snd_pmac_daca_init(struct snd_pmac *chip) request_module("i2c-powermac"); #endif /* CONFIG_KMOD */ - mix = kmalloc(sizeof(*mix), GFP_KERNEL); + mix = kzalloc(sizeof(*mix), GFP_KERNEL); if (! mix) return -ENOMEM; - memset(mix, 0, sizeof(*mix)); chip->mixer_data = mix; chip->mixer_free = daca_cleanup; mix->amp_on = 1; /* default on */ diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c index fb05938dcbd9..59482a4cd446 100644 --- a/sound/ppc/keywest.c +++ b/sound/ppc/keywest.c @@ -64,11 +64,10 @@ static int keywest_attach_adapter(struct i2c_adapter *adapter) if (strncmp(i2c_device_name(adapter), "mac-io", 6)) return 0; /* ignored */ - new_client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); + new_client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); if (! new_client) return -ENOMEM; - memset(new_client, 0, sizeof(*new_client)); new_client->addr = keywest_ctx->addr; i2c_set_clientdata(new_client, keywest_ctx); new_client->adapter = adapter; diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c index 692c61177678..84f6b19c07ca 100644 --- a/sound/ppc/tumbler.c +++ b/sound/ppc/tumbler.c @@ -1316,10 +1316,9 @@ int __init snd_pmac_tumbler_init(struct snd_pmac *chip) request_module("i2c-powermac"); #endif /* CONFIG_KMOD */ - mix = kmalloc(sizeof(*mix), GFP_KERNEL); + mix = kzalloc(sizeof(*mix), GFP_KERNEL); if (! mix) return -ENOMEM; - memset(mix, 0, sizeof(*mix)); mix->headphone_irq = -1; chip->mixer_data = mix; -- cgit v1.2.3 From 545b07d3620c9eac3349398b5303d20cab260ff6 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Tue, 25 Jul 2006 16:14:16 +0200 Subject: [ALSA] make snd-powermac load even when it can't bind the device This patch makes snd-powermac load when it can't bind the device right away. That's the expected behaviour for hotplugging, but fixes an important problem I was seeing with doing a modprobe snd-powermac with a version that refuses loading on machines with layout-id: snd-powermac would create a bunch of uevents and then refuse to load, the uevents causing udev to reload it again, ad eternum. Signed-off-by: Johannes Berg Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- sound/ppc/powermac.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'sound/ppc') diff --git a/sound/ppc/powermac.c b/sound/ppc/powermac.c index fa9a44ab487e..2264574fa06b 100644 --- a/sound/ppc/powermac.c +++ b/sound/ppc/powermac.c @@ -181,21 +181,14 @@ static int __init alsa_card_pmac_init(void) if ((err = platform_driver_register(&snd_pmac_driver)) < 0) return err; device = platform_device_register_simple(SND_PMAC_DRIVER, -1, NULL, 0); - if (!IS_ERR(device)) { - if (platform_get_drvdata(device)) - return 0; - platform_device_unregister(device); - err = -ENODEV; - } else - err = PTR_ERR(device); - platform_driver_unregister(&snd_pmac_driver); - return err; + return 0; } static void __exit alsa_card_pmac_exit(void) { - platform_device_unregister(device); + if (!IS_ERR(device)) + platform_device_unregister(device); platform_driver_unregister(&snd_pmac_driver); } -- cgit v1.2.3