aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-06-10 06:15:27 -0400
committerTakashi Iwai <tiwai@suse.de>2015-06-10 06:15:27 -0400
commit692af901df615b7783caaccdb287cddf2d7f6059 (patch)
treedb693eec5c648e64c954f4c91393ff1d05610b0a
parent8721fa692bc218df3f0ad30740baedf176a41f56 (diff)
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: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/hda/hdac_i915.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c
index cb78c25585ac..442500e06b7c 100644
--- a/sound/hda/hdac_i915.c
+++ b/sound/hda/hdac_i915.c
@@ -27,7 +27,7 @@ int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable)
27{ 27{
28 struct i915_audio_component *acomp = bus->audio_component; 28 struct i915_audio_component *acomp = bus->audio_component;
29 29
30 if (!acomp->ops) 30 if (!acomp || !acomp->ops)
31 return -ENODEV; 31 return -ENODEV;
32 32
33 if (!acomp->ops->codec_wake_override) { 33 if (!acomp->ops->codec_wake_override) {
@@ -49,7 +49,7 @@ int snd_hdac_display_power(struct hdac_bus *bus, bool enable)
49{ 49{
50 struct i915_audio_component *acomp = bus->audio_component; 50 struct i915_audio_component *acomp = bus->audio_component;
51 51
52 if (!acomp->ops) 52 if (!acomp || !acomp->ops)
53 return -ENODEV; 53 return -ENODEV;
54 54
55 dev_dbg(bus->dev, "display power %s\n", 55 dev_dbg(bus->dev, "display power %s\n",
@@ -72,7 +72,7 @@ int snd_hdac_get_display_clk(struct hdac_bus *bus)
72{ 72{
73 struct i915_audio_component *acomp = bus->audio_component; 73 struct i915_audio_component *acomp = bus->audio_component;
74 74
75 if (!acomp->ops) 75 if (!acomp || !acomp->ops)
76 return -ENODEV; 76 return -ENODEV;
77 77
78 return acomp->ops->get_cdclk_freq(acomp->dev); 78 return acomp->ops->get_cdclk_freq(acomp->dev);
@@ -179,8 +179,11 @@ int snd_hdac_i915_exit(struct hdac_bus *bus)
179 struct device *dev = bus->dev; 179 struct device *dev = bus->dev;
180 struct i915_audio_component *acomp = bus->audio_component; 180 struct i915_audio_component *acomp = bus->audio_component;
181 181
182 if (!acomp)
183 return 0;
184
182 WARN_ON(bus->i915_power_refcount); 185 WARN_ON(bus->i915_power_refcount);
183 if (bus->i915_power_refcount > 0 && acomp && acomp->ops) 186 if (bus->i915_power_refcount > 0 && acomp->ops)
184 acomp->ops->put_power(acomp->dev); 187 acomp->ops->put_power(acomp->dev);
185 188
186 component_master_del(dev, &hdac_component_master_ops); 189 component_master_del(dev, &hdac_component_master_ops);