Message ID | 1362210594-17633-1-git-send-email-broonie@opensource.wolfsonmicro.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 03/02/2013 08:49 AM, Mark Brown wrote: > This will probably never fail but it's better style. > > Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> > --- > sound/soc/omap/omap3pandora.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/sound/soc/omap/omap3pandora.c b/sound/soc/omap/omap3pandora.c > index 805512f..953483e 100644 > --- a/sound/soc/omap/omap3pandora.c > +++ b/sound/soc/omap/omap3pandora.c > @@ -85,7 +85,11 @@ static int omap3pandora_dac_event(struct snd_soc_dapm_widget *w, > * VCC power on/off and /PD pin high/low > */ > if (SND_SOC_DAPM_EVENT_ON(event)) { > - regulator_enable(omap3pandora_dac_reg); > + ret = regulator_enable(omap3pandora_dac_reg); > + if (ret != 0) { The rest of this machine driver uses "if (ret < 0)" or "if (ret)". I would use: + if (ret) { > + dev_err(w->dapm.dev, "Failed to power DAC: %d\n", ret); > + return ret; > + } > mdelay(1); > gpio_set_value(OMAP3_PANDORA_DAC_POWER_GPIO, 1); > } else { > Otherwise: Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com> -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Sat, 2013-03-02 at 16:02 +0100, Peter Ujfalusi wrote: > > diff --git a/sound/soc/omap/omap3pandora.c b/sound/soc/omap/omap3pandora.c > > index 805512f..953483e 100644 > > --- a/sound/soc/omap/omap3pandora.c > > +++ b/sound/soc/omap/omap3pandora.c > > @@ -85,7 +85,11 @@ static int omap3pandora_dac_event(struct snd_soc_dapm_widget *w, > > * VCC power on/off and /PD pin high/low > > */ > > if (SND_SOC_DAPM_EVENT_ON(event)) { > > - regulator_enable(omap3pandora_dac_reg); > > + ret = regulator_enable(omap3pandora_dac_reg); > > + if (ret != 0) { > > The rest of this machine driver uses "if (ret < 0)" or "if (ret)". I would use: > + if (ret) { > ... > Otherwise: > Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com> > To whatever version of (ret != 0), (ret) or (ret < 0) is used :-) Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com> -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/sound/soc/omap/omap3pandora.c b/sound/soc/omap/omap3pandora.c index 805512f..953483e 100644 --- a/sound/soc/omap/omap3pandora.c +++ b/sound/soc/omap/omap3pandora.c @@ -85,7 +85,11 @@ static int omap3pandora_dac_event(struct snd_soc_dapm_widget *w, * VCC power on/off and /PD pin high/low */ if (SND_SOC_DAPM_EVENT_ON(event)) { - regulator_enable(omap3pandora_dac_reg); + ret = regulator_enable(omap3pandora_dac_reg); + if (ret != 0) { + dev_err(w->dapm.dev, "Failed to power DAC: %d\n", ret); + return ret; + } mdelay(1); gpio_set_value(OMAP3_PANDORA_DAC_POWER_GPIO, 1); } else {
This will probably never fail but it's better style. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> --- sound/soc/omap/omap3pandora.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)