static void bebob_free(struct snd_bebob *bebob)
{
snd_bebob_stream_destroy_duplex(bebob);
- fw_unit_put(bebob->unit);
kfree(bebob->maudio_special_quirk);
mutex_destroy(&bebob->mutex);
- kfree(bebob);
+ fw_unit_put(bebob->unit);
}
/*
}
/* Allocate this independent of sound card instance. */
- bebob = kzalloc(sizeof(struct snd_bebob), GFP_KERNEL);
- if (bebob == NULL)
+ bebob = devm_kzalloc(&unit->device, sizeof(struct snd_bebob),
+ GFP_KERNEL);
+ if (!bebob)
return -ENOMEM;
-
bebob->unit = fw_unit_get(unit);
- bebob->entry = entry;
- bebob->spec = spec;
dev_set_drvdata(&unit->device, bebob);
+ bebob->entry = entry;
+ bebob->spec = spec;
mutex_init(&bebob->mutex);
spin_lock_init(&bebob->lock);
init_waitqueue_head(&bebob->hwdep_wait);
{
snd_dice_stream_destroy_duplex(dice);
snd_dice_transaction_destroy(dice);
- fw_unit_put(dice->unit);
mutex_destroy(&dice->mutex);
- kfree(dice);
+ fw_unit_put(dice->unit);
}
/*
}
/* Allocate this independent of sound card instance. */
- dice = kzalloc(sizeof(struct snd_dice), GFP_KERNEL);
- if (dice == NULL)
+ dice = devm_kzalloc(&unit->device, sizeof(struct snd_dice), GFP_KERNEL);
+ if (!dice)
return -ENOMEM;
-
dice->unit = fw_unit_get(unit);
dev_set_drvdata(&unit->device, dice);
snd_dg00x_stream_destroy_duplex(dg00x);
snd_dg00x_transaction_unregister(dg00x);
- fw_unit_put(dg00x->unit);
-
mutex_destroy(&dg00x->mutex);
- kfree(dg00x);
+ fw_unit_put(dg00x->unit);
}
static void dg00x_card_free(struct snd_card *card)
struct snd_dg00x *dg00x;
/* Allocate this independent of sound card instance. */
- dg00x = kzalloc(sizeof(struct snd_dg00x), GFP_KERNEL);
- if (dg00x == NULL)
+ dg00x = devm_kzalloc(&unit->device, sizeof(struct snd_dg00x),
+ GFP_KERNEL);
+ if (!dg00x)
return -ENOMEM;
dg00x->unit = fw_unit_get(unit);
snd_ff_stream_destroy_duplex(ff);
snd_ff_transaction_unregister(ff);
- fw_unit_put(ff->unit);
-
mutex_destroy(&ff->mutex);
- kfree(ff);
+ fw_unit_put(ff->unit);
}
static void ff_card_free(struct snd_card *card)
{
struct snd_ff *ff;
- ff = kzalloc(sizeof(struct snd_ff), GFP_KERNEL);
- if (ff == NULL)
+ ff = devm_kzalloc(&unit->device, sizeof(struct snd_ff), GFP_KERNEL);
+ if (!ff)
return -ENOMEM;
-
- /* initialize myself */
ff->unit = fw_unit_get(unit);
dev_set_drvdata(&unit->device, ff);
{
snd_efw_stream_destroy_duplex(efw);
snd_efw_transaction_remove_instance(efw);
- fw_unit_put(efw->unit);
kfree(efw->resp_buf);
mutex_destroy(&efw->mutex);
- kfree(efw);
+ fw_unit_put(efw->unit);
}
/*
{
struct snd_efw *efw;
- efw = kzalloc(sizeof(struct snd_efw), GFP_KERNEL);
+ efw = devm_kzalloc(&unit->device, sizeof(struct snd_efw), GFP_KERNEL);
if (efw == NULL)
return -ENOMEM;
-
efw->unit = fw_unit_get(unit);
dev_set_drvdata(&unit->device, efw);
snd_motu_transaction_unregister(motu);
snd_motu_stream_destroy_duplex(motu);
- fw_unit_put(motu->unit);
mutex_destroy(&motu->mutex);
- kfree(motu);
+ fw_unit_put(motu->unit);
}
/*
struct snd_motu *motu;
/* Allocate this independently of sound card instance. */
- motu = kzalloc(sizeof(struct snd_motu), GFP_KERNEL);
- if (motu == NULL)
+ motu = devm_kzalloc(&unit->device, sizeof(struct snd_motu), GFP_KERNEL);
+ if (!motu)
return -ENOMEM;
-
- motu->spec = (const struct snd_motu_spec *)entry->driver_data;
motu->unit = fw_unit_get(unit);
dev_set_drvdata(&unit->device, motu);
+ motu->spec = (const struct snd_motu_spec *)entry->driver_data;
mutex_init(&motu->mutex);
spin_lock_init(&motu->lock);
init_waitqueue_head(&motu->hwdep_wait);
if (oxfw->has_output)
snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->tx_stream);
- fw_unit_put(oxfw->unit);
-
for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; i++) {
kfree(oxfw->tx_stream_formats[i]);
kfree(oxfw->rx_stream_formats[i]);
kfree(oxfw->spec);
mutex_destroy(&oxfw->mutex);
- kfree(oxfw);
+ fw_unit_put(oxfw->unit);
}
/*
return -ENODEV;
/* Allocate this independent of sound card instance. */
- oxfw = kzalloc(sizeof(struct snd_oxfw), GFP_KERNEL);
- if (oxfw == NULL)
+ oxfw = devm_kzalloc(&unit->device, sizeof(struct snd_oxfw), GFP_KERNEL);
+ if (!oxfw)
return -ENOMEM;
-
- oxfw->entry = entry;
oxfw->unit = fw_unit_get(unit);
dev_set_drvdata(&unit->device, oxfw);
+ oxfw->entry = entry;
mutex_init(&oxfw->mutex);
spin_lock_init(&oxfw->lock);
init_waitqueue_head(&oxfw->hwdep_wait);
snd_tscm_transaction_unregister(tscm);
snd_tscm_stream_destroy_duplex(tscm);
- fw_unit_put(tscm->unit);
-
mutex_destroy(&tscm->mutex);
- kfree(tscm);
+ fw_unit_put(tscm->unit);
}
static void tscm_card_free(struct snd_card *card)
struct snd_tscm *tscm;
/* Allocate this independent of sound card instance. */
- tscm = kzalloc(sizeof(struct snd_tscm), GFP_KERNEL);
- if (tscm == NULL)
+ tscm = devm_kzalloc(&unit->device, sizeof(struct snd_tscm), GFP_KERNEL);
+ if (!tscm)
return -ENOMEM;
-
- /* initialize myself */
tscm->unit = fw_unit_get(unit);
dev_set_drvdata(&unit->device, tscm);