All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: ASoC: codecs: Add AB8500 codec-driver
@ 2012-06-16 13:19 Dan Carpenter
  2012-06-19  8:50 ` Ola Lilja
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-06-16 13:19 UTC (permalink / raw)
  To: ola.o.lilja; +Cc: alsa-devel

Hello Ola Lilja,

The patch 679d7abdc754: "ASoC: codecs: Add AB8500 codec-driver" from
Jun 7, 2012, leads to the following Sparse warnings:

sound/soc/codecs/ab8500-codec.c:1960:53:
	warning: cast truncates bits from constant value (1013 becomes 13)
sound/soc/codecs/ab8500-codec.c:1968:53:
	warning: cast truncates bits from constant value (1013 becomes 13)

sound/soc/codecs/ab8500-codec.c
  1958          /* Set DMic-clocks to outputs */
  1959          status = abx500_get_register_interruptible(codec->dev, (u8)AB8500_MISC,
  1960                                                  (u8)AB8500_GPIO_DIR4_REG,
                                                            ^^^^^^^^^^^^^^^^^^^^
  1961                                                  &value8);
  1962          if (status < 0)
  1963                  return status;
  1964          value = value8 | GPIO27_DIR_OUTPUT | GPIO29_DIR_OUTPUT |
  1965                  GPIO31_DIR_OUTPUT;
  1966          status = abx500_set_register_interruptible(codec->dev,
  1967                                                  (u8)AB8500_MISC,
  1968                                                  (u8)AB8500_GPIO_DIR4_REG,
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^
  1969                                                  value);

In my quick check we only seem to use the truncated values of these
defines so I'm not sure this was intended.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ASoC: codecs: Add AB8500 codec-driver
  2012-06-16 13:19 ASoC: codecs: Add AB8500 codec-driver Dan Carpenter
@ 2012-06-19  8:50 ` Ola Lilja
  0 siblings, 0 replies; 2+ messages in thread
From: Ola Lilja @ 2012-06-19  8:50 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: alsa-devel@alsa-project.org

On 06/16/2012 03:19 PM, Dan Carpenter wrote:

> Hello Ola Lilja,

> 

Hi Dan!

> The patch 679d7abdc754: "ASoC: codecs: Add AB8500 codec-driver" from
> Jun 7, 2012, leads to the following Sparse warnings:
> 
> sound/soc/codecs/ab8500-codec.c:1960:53:
> 	warning: cast truncates bits from constant value (1013 becomes 13)
> sound/soc/codecs/ab8500-codec.c:1968:53:
> 	warning: cast truncates bits from constant value (1013 becomes 13)
> 
> sound/soc/codecs/ab8500-codec.c
>   1958          /* Set DMic-clocks to outputs */
>   1959          status = abx500_get_register_interruptible(codec->dev, (u8)AB8500_MISC,
>   1960                                                  (u8)AB8500_GPIO_DIR4_REG,
>                                                             ^^^^^^^^^^^^^^^^^^^^
>   1961                                                  &value8);
>   1962          if (status < 0)
>   1963                  return status;
>   1964          value = value8 | GPIO27_DIR_OUTPUT | GPIO29_DIR_OUTPUT |
>   1965                  GPIO31_DIR_OUTPUT;
>   1966          status = abx500_set_register_interruptible(codec->dev,
>   1967                                                  (u8)AB8500_MISC,
>   1968                                                  (u8)AB8500_GPIO_DIR4_REG,
>                                                         ^^^^^^^^^^^^^^^^^^^^^^^^
>   1969                                                  value);
> 
> In my quick check we only seem to use the truncated values of these
> defines so I'm not sure this was intended.


The error here is that for that variable the bank-byte has (faulty) been
attached to the register-byte, where the bank is 0x10. This should not have been
there and the result after truncation is the correct value of 0x13.
Our registers are only 8-bits. We have fixed this define in an internal patch so
it will show up here eventually.

Thanks for pointing it out!

> 
> regards,
> dan carpenter
> 


regards,
Ola Lilja

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-06-19  8:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-16 13:19 ASoC: codecs: Add AB8500 codec-driver Dan Carpenter
2012-06-19  8:50 ` Ola Lilja

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.