History

ASoC: ac97: Be sure to clamp return value

As we want gpio_chip .get() calls to be able to return negative error codes and propagate to drivers, we need to go over all drivers and make sure their return values are clamped to [0,1]. We do this by using the ret = !!(val) design pattern.

Linus Walleij committed 10 years ago

Commit 34015f51 parent 9bf5c3d1 file · +1 −1Browse files

Unified · Split

sound/soc/soc-ac97.c+1−1
@@ -92,7 +92,7 @@ static int snd_soc_ac97_gpio_get(struct gpio_chip *chip, unsigned offset) · 91 unmodified lines
9292 dev_dbg(codec->dev, "get gpio %d : %d\n", offset,
9393 ret < 0 ? ret : ret & (1 << offset));
9494
95− return ret < 0 ? ret : ret & (1 << offset);
95+ return ret < 0 ? ret : !!(ret & (1 << offset));
9696 }
9797
9898 static void snd_soc_ac97_gpio_set(struct gpio_chip *chip, unsigned offset,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t