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

Commit 607975b3 authored by Ding Xiang's avatar Ding Xiang Committed by Takashi Iwai
Browse files

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: 74426fbf ("ALSA: ac97: add an ac97 bus")
Signed-off-by: default avatarDing Xiang <dingxiang@cmss.chinamobile.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 3b817994
Loading
Loading
Loading
Loading
+4 −9
Original line number Diff line number Diff line
@@ -122,19 +122,14 @@ static int ac97_codec_add(struct ac97_controller *ac97_ctrl, int idx,
						      vendor_id);

	ret = device_add(&codec->dev);
	if (ret)
		goto err_free_codec;

	return 0;
err_free_codec:
	of_node_put(codec->dev.of_node);
	if (ret) {
		put_device(&codec->dev);
	kfree(codec);
	ac97_ctrl->codecs[idx] = NULL;

		return ret;
	}

	return 0;
}

unsigned int snd_ac97_bus_scan_one(struct ac97_controller *adrv,
				   unsigned int codec_num)
{