Skip to content

Commit 607975b

Browse files
Ding Xiangtiwai
authored andcommitted
ALSA: ac97: Fix double free of ac97_codec_device
put_device will call ac97_codec_release to free ac97_codec_device and other resources, so remove the kfree and other redundant code. Fixes: 74426fb ("ALSA: ac97: add an ac97 bus") Signed-off-by: Ding Xiang <[email protected]> Cc: <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent 3b81799 commit 607975b

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

sound/ac97/bus.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,12 @@ static int ac97_codec_add(struct ac97_controller *ac97_ctrl, int idx,
122122
vendor_id);
123123

124124
ret = device_add(&codec->dev);
125-
if (ret)
126-
goto err_free_codec;
125+
if (ret) {
126+
put_device(&codec->dev);
127+
return ret;
128+
}
127129

128130
return 0;
129-
err_free_codec:
130-
of_node_put(codec->dev.of_node);
131-
put_device(&codec->dev);
132-
kfree(codec);
133-
ac97_ctrl->codecs[idx] = NULL;
134-
135-
return ret;
136131
}
137132

138133
unsigned int snd_ac97_bus_scan_one(struct ac97_controller *adrv,

0 commit comments

Comments
 (0)