[alsa-devel] [PATCH] ASoC: rt286: Fix the runtime error in the booting
The struct rt286_index_def was used by the cache function, so it cannot be declared as const.
Signed-off-by: Oder Chiou oder_chiou@realtek.com --- sound/soc/codecs/rt286.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c index 1fbdb4f..79107dc 100644 --- a/sound/soc/codecs/rt286.c +++ b/sound/soc/codecs/rt286.c @@ -49,7 +49,7 @@ struct rt286_priv { int clk_id; };
-static const struct reg_default rt286_index_def[] = { +static struct reg_default rt286_index_def[] = { { 0x01, 0xaaaa }, { 0x02, 0x8aaa }, { 0x03, 0x0002 },
On Fri, Oct 02, 2015 at 01:30:29PM +0800, Oder Chiou wrote:
The struct rt286_index_def was used by the cache function, so it cannot be declared as const.
-static const struct reg_default rt286_index_def[] = { +static struct reg_default rt286_index_def[] = { { 0x01, 0xaaaa }, { 0x02, 0x8aaa }, { 0x03, 0x0002 },
This isn't obvious and seems likely to break - why is this ever being modified and how is that safe?
-----Original Message----- From: Mark Brown [mailto:broonie@kernel.org] Sent: Friday, October 02, 2015 6:12 PM To: Oder Chiou Cc: lgirdwood@gmail.com; alsa-devel@alsa-project.org; Flove; Bard Liao; John Lin; flubba86@gmail.com Subject: Re: [PATCH] ASoC: rt286: Fix the runtime error in the booting
On Fri, Oct 02, 2015 at 01:30:29PM +0800, Oder Chiou wrote:
The struct rt286_index_def was used by the cache function, so it cannot be declared as const.
-static const struct reg_default rt286_index_def[] = { +static struct reg_default rt286_index_def[] = { { 0x01, 0xaaaa }, { 0x02, 0x8aaa }, { 0x03, 0x0002 },
This isn't obvious and seems likely to break - why is this ever being modified and how is that safe?
The table was used for the cache function of the index table, so it would be changed the value in the index register writing. The breaking is in that the variable of type "const" is changing. And the wrong modification was committed by "c418a84a8c8f98b1a0f30cd68d0cdf40d77aed01". The modifications of the commit are correct in the conventional case, but it will be breaking in case of rt286 and rt298.
On Mon, Oct 05, 2015 at 04:09:58AM +0000, Oder Chiou wrote:
This isn't obvious and seems likely to break - why is this ever being modified and how is that safe?
The table was used for the cache function of the index table, so it would be changed the value in the index register writing. The breaking is in that the variable of type "const" is changing. And the wrong modification was committed by "c418a84a8c8f98b1a0f30cd68d0cdf40d77aed01". The modifications of the commit are correct in the conventional case, but it will be breaking in case of rt286 and rt298.
I'm sorry but this isn't clarifying anything at all for me. You are simply stating that this is safe but not explaning why - you need to explain why. If nothing else if a driver is modifying global static data that's bad practice, the driver should be copying the data into somewhere driver private and then modifying that.
Please also remember to include human readable descriptions of commits so that any humans reading your mail can do so directly.
participants (2)
-
Mark Brown
-
Oder Chiou