Skip to contentSkip to conversation

ASoC: adau1977: Fix truncation warning on 64 bit architectures

PATCH In review Mark Brown 2 participants 2 messages Aug 1, 2014 – Aug 4, 2014

Subsystems (3)
lore
Share & tools
lore

Mark Brown

author maintainer
#0 lore raw

PATCH 1/1 ASoC: adau1977: Fix truncation warning on 64 bit architectures

From: Mark Brown <[email protected]>

Negating ADAU1977_BLOCK_POWER_SAI_LDO_EN creates an unsigned long constant with all bits set which on 64 bit architectures needs to be truncated to an unsigned int, generating a warning. Add an explicit cast since we know this is OK.

---
 sound/soc/codecs/adau1977.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/adau1977.c +1 -1
index fd55da7..70ab357 100644
@@ -968,7 +968,7 @@ int adau1977_probe(struct device *dev, struct regmap *regmap,
 	if (adau1977->dvdd_reg)
 		power_off_mask = ~0;
 	else
-		power_off_mask = ~ADAU1977_BLOCK_POWER_SAI_LDO_EN;
+		power_off_mask = (unsigned int)~ADAU1977_BLOCK_POWER_SAI_LDO_EN;
 
 	ret = regmap_update_bits(adau1977->regmap, ADAU1977_REG_BLOCK_POWER_SAI,
 				power_off_mask, 0x00);
Signature · 1 line
2.0.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Mark Brown

From: Mark Brown <[email protected]>

Negating ADAU1977_BLOCK_POWER_SAI_LDO_EN creates an unsigned long constant with all bits set which on 64 bit architectures needs to be truncated to an unsigned int, generating a warning. Add an explicit cast since we know this is OK.

Thanks.

Quoted 18 lines
---
  sound/soc/codecs/adau1977.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/adau1977.c +1 -1
index fd55da7..70ab357 100644
@@ -968,7 +968,7 @@ int adau1977_probe(struct device *dev, struct regmap *regmap,
  	if (adau1977->dvdd_reg)
  		power_off_mask = ~0;
  	else
-		power_off_mask = ~ADAU1977_BLOCK_POWER_SAI_LDO_EN;
+		power_off_mask = (unsigned int)~ADAU1977_BLOCK_POWER_SAI_LDO_EN;
 
  	ret = regmap_update_bits(adau1977->regmap, ADAU1977_REG_BLOCK_POWER_SAI,
  				power_off_mask, 0x00);