[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4E845667.3050404@gmail.com>
Date: Thu, 29 Sep 2011 21:28:39 +1000
From: Ryan Mallon <rmallon@...il.com>
To: Mark Brown <broonie@...nsource.wolfsonmicro.com>
CC: Axel Lin <axel.lin@...il.com>, linux-kernel@...r.kernel.org,
Liam Girdwood <lrg@...com>, alsa-devel@...a-project.org,
Peter Hsiang <peter.hsiang@...im-ic.com>,
Jesse Marroquin <jesse.marroquin@...im-ic.com>
Subject: Re: [PATCH 1/2] ASoC: Add BUG() assertion if max98088_get_channel
returns -EINVAL
On 29/09/11 20:34, Mark Brown wrote:
> On Thu, Sep 29, 2011 at 09:15:03AM +1000, Ryan Mallon wrote:
>> On 29/09/11 00:01, Axel Lin wrote:
>>> The callers use the return value of max98088_get_channel as array index to
>>> access max98088->dai[] array.
>>> Add BUG() assertion for out of bound access of max98088->dai[] array.
>> BUG() is pretty heavy handed for a driver. Why not fix the problem
>> properly in the callers?
> There's nothing constructive that any of the callers can do with an
> error code - it's a clear bug in something (probably the driver) if we
> get called for a bad control. Simply returning an error code isn't
> terribly helpful, it's very obscure what's gone wrong and why. We at
> least need a log message.
Yeah, it can basically only happen if there is a mismatch between the
kcontrol definition and the get_channel function in the driver. Would
you be happy with adding a:
dev_err(codec->dev, "Bad kcontrol channel name\n");
and then returning the error? It doesn't seem worth panicking the whole
driver/system for a bug like this.
~Ryan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists