Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: da7219: Improve error handling for regulator supplies

Currently if bulk_enable() of supplies fails, the code still goes on
to try and put the device into active state, and set expected IO
voltage of the device. This doesn't really make sense so code now
returns on bulk_enable() failure, with an error message. Also,
to help with debug, failure to get supplies also provides an error
message.

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Adam Thomson and committed by
Mark Brown
4e929134 7c933772

+8 -2
+8 -2
sound/soc/codecs/da7219.c
··· 1554 1554 1555 1555 ret = devm_regulator_bulk_get(codec->dev, DA7219_NUM_SUPPLIES, 1556 1556 da7219->supplies); 1557 - if (ret) 1557 + if (ret) { 1558 + dev_err(codec->dev, "Failed to get supplies"); 1558 1559 return ret; 1560 + } 1559 1561 1560 1562 /* Determine VDDIO voltage provided */ 1561 1563 vddio = da7219->supplies[DA7219_SUPPLY_VDDIO].consumer; ··· 1569 1567 1570 1568 /* Enable main supplies */ 1571 1569 ret = regulator_bulk_enable(DA7219_NUM_SUPPLIES, da7219->supplies); 1570 + if (ret) { 1571 + dev_err(codec->dev, "Failed to enable supplies"); 1572 + return ret; 1573 + } 1572 1574 1573 1575 /* Ensure device in active mode */ 1574 1576 snd_soc_write(codec, DA7219_SYSTEM_ACTIVE, DA7219_SYSTEM_ACTIVE_MASK); ··· 1580 1574 /* Update IO voltage level range */ 1581 1575 snd_soc_write(codec, DA7219_IO_CTRL, io_voltage_lvl); 1582 1576 1583 - return ret; 1577 + return 0; 1584 1578 } 1585 1579 1586 1580 static void da7219_handle_pdata(struct snd_soc_codec *codec)