Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: dib0070: incorrect format specifiers detected by clang

drivers/media/dvb-frontends/dib0070.c:192:52: warning: format specifies type 'short' but the argument has type 's8' (aka 'signed char') [-Wformat]
dprintk("CAPTRIM=%hd; ADC = %hd (ADC) & %dmV\n", state->captrim, adc, (u32) adc*(u32)1800/(u32)1024);
~~~ ^~~~~~~~~~~~~~
%hhd
drivers/media/dvb-frontends/dib0070.c:30:22: note: expanded from macro 'dprintk'
__func__, ##arg); \
^~~
drivers/media/dvb-frontends/dib0070.c:203:59: warning: format specifies type 'short' but the argument has type 's8' (aka 'signed char') [-Wformat]
dprintk("CAPTRIM=%hd is closer to target (%hd/%hd)\n", state->captrim, adc, state->adc_diff);
~~~ ^~~~~~~~~~~~~~
%hhd
drivers/media/dvb-frontends/dib0070.c:30:22: note: expanded from macro 'dprintk'
__func__, ##arg); \
^~~
drivers/media/dvb-frontends/dib0070.c:367:46: warning: format specifies type 'short' but the argument has type 'u8' (aka 'unsigned char') [-Wformat]
dprintk("Tuning for Band: %hd (%d kHz)\n", band, freq);
~~~ ^~~~
%hhu
drivers/media/dvb-frontends/dib0070.c:30:22: note: expanded from macro 'dprintk'
__func__, ##arg); \
^~~
drivers/media/dvb-frontends/dib0070.c:445:39: warning: format specifies type 'short' but the argument has type 'u8' (aka 'unsigned char') [-Wformat]
dprintk("REFDIV: %hd, FREF: %d\n", REFDIV, FREF);
~~~ ^~~~~~
%hhu
drivers/media/dvb-frontends/dib0070.c:30:22: note: expanded from macro 'dprintk'
__func__, ##arg); \
^~~
drivers/media/dvb-frontends/dib0070.c:447:57: warning: format specifies type 'short' but the argument has type 'u8' (aka 'unsigned char') [-Wformat]
dprintk("Num: %hd, Den: %hd, SD: %hd\n", (u16) Rest, Den, (state->lo4 >> 12) & 0x1);
~~~ ^~~
%hhu
drivers/media/dvb-frontends/dib0070.c:30:22: note: expanded from macro 'dprintk'
__func__, ##arg); \
^~~
drivers/media/dvb-frontends/dib0070.c:447:62: warning: format specifies type 'short' but the argument has type 'int' [-Wformat]
dprintk("Num: %hd, Den: %hd, SD: %hd\n", (u16) Rest, Den, (state->lo4 >> 12) & 0x1);
~~~ ^~~~~~~~~~~~~~~~~~~~~~~~
%d
drivers/media/dvb-frontends/dib0070.c:30:22: note: expanded from macro 'dprintk'
__func__, ##arg); \
^~~
drivers/media/dvb-frontends/dib0070.c:448:33: warning: format specifies type 'short' but the argument has type 'u8' (aka 'unsigned char') [-Wformat]
dprintk("HFDIV code: %hd\n", state->current_tune_table_index->hfdiv);
~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%hhu
drivers/media/dvb-frontends/dib0070.c:30:22: note: expanded from macro 'dprintk'
__func__, ##arg); \
^~~
drivers/media/dvb-frontends/dib0070.c:449:27: warning: format specifies type 'short' but the argument has type 'u8' (aka 'unsigned char') [-Wformat]
dprintk("VCO = %hd\n", state->current_tune_table_index->vco_band);
~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%hhu
drivers/media/dvb-frontends/dib0070.c:30:22: note: expanded from macro 'dprintk'
__func__, ##arg); \
^~~
drivers/media/dvb-frontends/dib0070.c:450:40: warning: format specifies type 'short' but the argument has type 'u8' (aka 'unsigned char') [-Wformat]
dprintk("VCOF: ((%hd*%d) << 1))\n", state->current_tune_table_index->vco_multi, freq);
~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%hhu
drivers/media/dvb-frontends/dib0070.c:30:22: note: expanded from macro 'dprintk'
__func__, ##arg); \
^~~

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

authored by

Sean Young and committed by
Mauro Carvalho Chehab
f54def5b 4ec14f24

+15 -8
+15 -8
drivers/media/dvb-frontends/dib0070.c
··· 189 189 190 190 adc = dib0070_read_reg(state, 0x19); 191 191 192 - dprintk("CAPTRIM=%hd; ADC = %hd (ADC) & %dmV\n", state->captrim, adc, (u32) adc*(u32)1800/(u32)1024); 192 + dprintk("CAPTRIM=%d; ADC = %hd (ADC) & %dmV\n", state->captrim, 193 + adc, (u32)adc * (u32)1800 / (u32)1024); 193 194 194 195 if (adc >= 400) { 195 196 adc -= 400; ··· 201 200 } 202 201 203 202 if (adc < state->adc_diff) { 204 - dprintk("CAPTRIM=%hd is closer to target (%hd/%hd)\n", state->captrim, adc, state->adc_diff); 203 + dprintk("CAPTRIM=%d is closer to target (%hd/%hd)\n", 204 + state->captrim, adc, state->adc_diff); 205 205 state->adc_diff = adc; 206 206 state->fcaptrim = state->captrim; 207 207 } ··· 366 364 } 367 365 368 366 if (*tune_state == CT_TUNER_START) { 369 - dprintk("Tuning for Band: %hd (%d kHz)\n", band, freq); 367 + dprintk("Tuning for Band: %d (%d kHz)\n", band, freq); 370 368 if (state->current_rf != freq) { 371 369 u8 REFDIV; 372 370 u32 FBDiv, Rest, FREF, VCOF_kHz; ··· 444 442 dib0070_write_reg(state, 0x20, 445 443 0x0040 | 0x0020 | 0x0010 | 0x0008 | 0x0002 | 0x0001 | state->current_tune_table_index->tuner_enable); 446 444 447 - dprintk("REFDIV: %hd, FREF: %d\n", REFDIV, FREF); 445 + dprintk("REFDIV: %u, FREF: %d\n", REFDIV, FREF); 448 446 dprintk("FBDIV: %d, Rest: %d\n", FBDiv, Rest); 449 - dprintk("Num: %hd, Den: %hd, SD: %hd\n", (u16) Rest, Den, (state->lo4 >> 12) & 0x1); 450 - dprintk("HFDIV code: %hd\n", state->current_tune_table_index->hfdiv); 451 - dprintk("VCO = %hd\n", state->current_tune_table_index->vco_band); 452 - dprintk("VCOF: ((%hd*%d) << 1))\n", state->current_tune_table_index->vco_multi, freq); 447 + dprintk("Num: %u, Den: %u, SD: %d\n", (u16)Rest, Den, 448 + (state->lo4 >> 12) & 0x1); 449 + dprintk("HFDIV code: %u\n", 450 + state->current_tune_table_index->hfdiv); 451 + dprintk("VCO = %u\n", 452 + state->current_tune_table_index->vco_band); 453 + dprintk("VCOF: ((%u*%d) << 1))\n", 454 + state->current_tune_table_index->vco_multi, 455 + freq); 453 456 454 457 *tune_state = CT_TUNER_STEP_0; 455 458 } else { /* we are already tuned to this frequency - the configuration is correct */