diff options
-rw-r--r-- | sound/hda/hdac_i915.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c index f6854dbd7d8d..fb96aead8257 100644 --- a/sound/hda/hdac_i915.c +++ b/sound/hda/hdac_i915.c | |||
@@ -126,6 +126,8 @@ EXPORT_SYMBOL_GPL(snd_hdac_get_display_clk); | |||
126 | */ | 126 | */ |
127 | static int pin2port(hda_nid_t pin_nid) | 127 | static int pin2port(hda_nid_t pin_nid) |
128 | { | 128 | { |
129 | if (WARN_ON(pin_nid < 5 || pin_nid > 7)) | ||
130 | return -1; | ||
129 | return pin_nid - 4; | 131 | return pin_nid - 4; |
130 | } | 132 | } |
131 | 133 | ||
@@ -144,10 +146,14 @@ static int pin2port(hda_nid_t pin_nid) | |||
144 | int snd_hdac_sync_audio_rate(struct hdac_bus *bus, hda_nid_t nid, int rate) | 146 | int snd_hdac_sync_audio_rate(struct hdac_bus *bus, hda_nid_t nid, int rate) |
145 | { | 147 | { |
146 | struct i915_audio_component *acomp = bus->audio_component; | 148 | struct i915_audio_component *acomp = bus->audio_component; |
149 | int port; | ||
147 | 150 | ||
148 | if (!acomp || !acomp->ops || !acomp->ops->sync_audio_rate) | 151 | if (!acomp || !acomp->ops || !acomp->ops->sync_audio_rate) |
149 | return -ENODEV; | 152 | return -ENODEV; |
150 | return acomp->ops->sync_audio_rate(acomp->dev, pin2port(nid), rate); | 153 | port = pin2port(nid); |
154 | if (port < 0) | ||
155 | return -EINVAL; | ||
156 | return acomp->ops->sync_audio_rate(acomp->dev, port, rate); | ||
151 | } | 157 | } |
152 | EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate); | 158 | EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate); |
153 | 159 | ||
@@ -175,11 +181,15 @@ int snd_hdac_acomp_get_eld(struct hdac_bus *bus, hda_nid_t nid, | |||
175 | bool *audio_enabled, char *buffer, int max_bytes) | 181 | bool *audio_enabled, char *buffer, int max_bytes) |
176 | { | 182 | { |
177 | struct i915_audio_component *acomp = bus->audio_component; | 183 | struct i915_audio_component *acomp = bus->audio_component; |
184 | int port; | ||
178 | 185 | ||
179 | if (!acomp || !acomp->ops || !acomp->ops->get_eld) | 186 | if (!acomp || !acomp->ops || !acomp->ops->get_eld) |
180 | return -ENODEV; | 187 | return -ENODEV; |
181 | 188 | ||
182 | return acomp->ops->get_eld(acomp->dev, pin2port(nid), audio_enabled, | 189 | port = pin2port(nid); |
190 | if (port < 0) | ||
191 | return -EINVAL; | ||
192 | return acomp->ops->get_eld(acomp->dev, port, audio_enabled, | ||
183 | buffer, max_bytes); | 193 | buffer, max_bytes); |
184 | } | 194 | } |
185 | EXPORT_SYMBOL_GPL(snd_hdac_acomp_get_eld); | 195 | EXPORT_SYMBOL_GPL(snd_hdac_acomp_get_eld); |