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

Commit 692af901 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: hda - Allow calling snd_hdac_i915_*() without actual binding



Add the missing NULL checks so that snd_hdac_i915*() can be called
even after the binding with i915 failed.

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 8721fa69
Loading
Loading
Loading
Loading
+7 −4
Original line number Original line Diff line number Diff line
@@ -27,7 +27,7 @@ int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable)
{
{
	struct i915_audio_component *acomp = bus->audio_component;
	struct i915_audio_component *acomp = bus->audio_component;


	if (!acomp->ops)
	if (!acomp || !acomp->ops)
		return -ENODEV;
		return -ENODEV;


	if (!acomp->ops->codec_wake_override) {
	if (!acomp->ops->codec_wake_override) {
@@ -49,7 +49,7 @@ int snd_hdac_display_power(struct hdac_bus *bus, bool enable)
{
{
	struct i915_audio_component *acomp = bus->audio_component;
	struct i915_audio_component *acomp = bus->audio_component;


	if (!acomp->ops)
	if (!acomp || !acomp->ops)
		return -ENODEV;
		return -ENODEV;


	dev_dbg(bus->dev, "display power %s\n",
	dev_dbg(bus->dev, "display power %s\n",
@@ -72,7 +72,7 @@ int snd_hdac_get_display_clk(struct hdac_bus *bus)
{
{
	struct i915_audio_component *acomp = bus->audio_component;
	struct i915_audio_component *acomp = bus->audio_component;


	if (!acomp->ops)
	if (!acomp || !acomp->ops)
		return -ENODEV;
		return -ENODEV;


	return acomp->ops->get_cdclk_freq(acomp->dev);
	return acomp->ops->get_cdclk_freq(acomp->dev);
@@ -179,8 +179,11 @@ int snd_hdac_i915_exit(struct hdac_bus *bus)
	struct device *dev = bus->dev;
	struct device *dev = bus->dev;
	struct i915_audio_component *acomp = bus->audio_component;
	struct i915_audio_component *acomp = bus->audio_component;


	if (!acomp)
		return 0;

	WARN_ON(bus->i915_power_refcount);
	WARN_ON(bus->i915_power_refcount);
	if (bus->i915_power_refcount > 0 && acomp && acomp->ops)
	if (bus->i915_power_refcount > 0 && acomp->ops)
		acomp->ops->put_power(acomp->dev);
		acomp->ops->put_power(acomp->dev);


	component_master_del(dev, &hdac_component_master_ops);
	component_master_del(dev, &hdac_component_master_ops);