summaryrefslogtreecommitdiffstats
path: root/sound/hda
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-06-10 12:15:27 +0200
committerTakashi Iwai <tiwai@suse.de>2015-06-10 12:15:27 +0200
commit692af901df615b7783caaccdb287cddf2d7f6059 (patch)
treedb693eec5c648e64c954f4c91393ff1d05610b0a /sound/hda
parentDoc: sound:oss: Fix typo in sound/oss (diff)
downloadlinux-692af901df615b7783caaccdb287cddf2d7f6059.tar.xz
linux-692af901df615b7783caaccdb287cddf2d7f6059.zip
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>
Diffstat (limited to 'sound/hda')
-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)
{
struct i915_audio_component *acomp = bus->audio_component;
- if (!acomp->ops)
+ if (!acomp || !acomp->ops)
return -ENODEV;
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;
- if (!acomp->ops)
+ if (!acomp || !acomp->ops)
return -ENODEV;
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;
- if (!acomp->ops)
+ if (!acomp || !acomp->ops)
return -ENODEV;
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 i915_audio_component *acomp = bus->audio_component;
+ if (!acomp)
+ return 0;
+
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);
component_master_del(dev, &hdac_component_master_ops);