diff options
Diffstat (limited to 'Documentation/sound/kernel-api/writing-an-alsa-driver.rst')
| -rw-r--r-- | Documentation/sound/kernel-api/writing-an-alsa-driver.rst | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Documentation/sound/kernel-api/writing-an-alsa-driver.rst b/Documentation/sound/kernel-api/writing-an-alsa-driver.rst index 895752cbcedd..86b64de03140 100644 --- a/Documentation/sound/kernel-api/writing-an-alsa-driver.rst +++ b/Documentation/sound/kernel-api/writing-an-alsa-driver.rst @@ -266,7 +266,7 @@ to details explained in the following section. .... /* allocate a chip-specific data with zero filled */ - chip = kzalloc(sizeof(*chip), GFP_KERNEL); + chip = kzalloc_obj(*chip); if (chip == NULL) return -ENOMEM; @@ -628,7 +628,7 @@ After allocating a card instance via :c:func:`snd_card_new()` err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, 0, &card); ..... - chip = kzalloc(sizeof(*chip), GFP_KERNEL); + chip = kzalloc_obj(*chip); The chip record should have the field to hold the card pointer at least, @@ -747,7 +747,7 @@ destructor and PCI entries. Example code is shown first, below:: return -ENXIO; } - chip = kzalloc(sizeof(*chip), GFP_KERNEL); + chip = kzalloc_obj(*chip); if (chip == NULL) { pci_disable_device(pci); return -ENOMEM; @@ -1737,7 +1737,7 @@ callback:: { struct my_pcm_data *data; .... - data = kmalloc(sizeof(*data), GFP_KERNEL); + data = kmalloc_obj(*data); substream->runtime->private_data = data; .... } @@ -3301,7 +3301,7 @@ You can then pass any pointer value to the ``private_data``. If you assign private data, you should define a destructor, too. The destructor function is set in the ``private_free`` field:: - struct mydata *p = kmalloc(sizeof(*p), GFP_KERNEL); + struct mydata *p = kmalloc_obj(*p); hw->private_data = p; hw->private_free = mydata_free; @@ -3833,7 +3833,7 @@ chip data individually:: err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, 0, &card); .... - chip = kzalloc(sizeof(*chip), GFP_KERNEL); + chip = kzalloc_obj(*chip); .... card->private_data = chip; .... |
