drivers/media/usb/dvb-usb/af9005.c:981:48: warning: suggest braces around empty body in an 'if' statement

From: kernel test robot
Date: Fri Jun 12 2020 - 05:52:40 EST


Hi Navid,

FYI, the error/warning still remains.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b791d1bdf9212d944d749a5c7ff6febdba241771
commit: 2289adbfa559050d2a38bcd9caac1c18b800e928 media: usb: fix memory leak in af9005_identify_state
date: 8 months ago
config: c6x-randconfig-r012-20200612 (attached as .config)
compiler: c6x-elf-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 2289adbfa559050d2a38bcd9caac1c18b800e928
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=c6x

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

drivers/media/usb/dvb-usb/af9005.c: In function 'af9005_read_ofdm_register':
drivers/media/usb/dvb-usb/af9005.c:144:32: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
144 | deb_reg("value %xn", *value);
| ^
drivers/media/usb/dvb-usb/af9005.c: In function 'af9005_read_ofdm_registers':
drivers/media/usb/dvb-usb/af9005.c:159:35: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
159 | debug_dump(values, len, deb_reg);
| ^
drivers/media/usb/dvb-usb/af9005.c: In function 'af9005_write_ofdm_register':
drivers/media/usb/dvb-usb/af9005.c:174:18: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
174 | deb_reg("okn");
| ^
drivers/media/usb/dvb-usb/af9005.c: In function 'af9005_write_ofdm_registers':
drivers/media/usb/dvb-usb/af9005.c:191:18: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
191 | deb_reg("okn");
| ^
drivers/media/usb/dvb-usb/af9005.c: In function 'af9005_identify_state':
>> drivers/media/usb/dvb-usb/af9005.c:981:48: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
981 | deb_info("Identify state cold = %dn", *cold);
| ^
/tmp/cc9dN54m.s: Assembler messages:
/tmp/cc9dN54m.s:4651: Warning: ignoring changed section attributes for .far
--
drivers/media/usb/dvb-usb/af9005.c: In function 'af9005_read_ofdm_register':
drivers/media/usb/dvb-usb/af9005.c:144:32: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
144 | deb_reg("value %xn", *value);
| ^
drivers/media/usb/dvb-usb/af9005.c: In function 'af9005_read_ofdm_registers':
drivers/media/usb/dvb-usb/af9005.c:159:35: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
159 | debug_dump(values, len, deb_reg);
| ^
drivers/media/usb/dvb-usb/af9005.c: In function 'af9005_write_ofdm_register':
drivers/media/usb/dvb-usb/af9005.c:174:18: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
174 | deb_reg("okn");
| ^
drivers/media/usb/dvb-usb/af9005.c: In function 'af9005_write_ofdm_registers':
drivers/media/usb/dvb-usb/af9005.c:191:18: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
191 | deb_reg("okn");
| ^
drivers/media/usb/dvb-usb/af9005.c: In function 'af9005_identify_state':
>> drivers/media/usb/dvb-usb/af9005.c:981:48: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
981 | deb_info("Identify state cold = %dn", *cold);
| ^
/tmp/ccqEAIu5.s: Assembler messages:
/tmp/ccqEAIu5.s:4651: Warning: ignoring changed section attributes for .far

vim +/if +981 drivers/media/usb/dvb-usb/af9005.c

af4e067e1dcf92 drivers/media/dvb/dvb-usb/af9005.c Luca Olivetti 2007-05-07 956
af4e067e1dcf92 drivers/media/dvb/dvb-usb/af9005.c Luca Olivetti 2007-05-07 957 static int af9005_identify_state(struct usb_device *udev,
af4e067e1dcf92 drivers/media/dvb/dvb-usb/af9005.c Luca Olivetti 2007-05-07 958 struct dvb_usb_device_properties *props,
af4e067e1dcf92 drivers/media/dvb/dvb-usb/af9005.c Luca Olivetti 2007-05-07 959 struct dvb_usb_device_description **desc,
af4e067e1dcf92 drivers/media/dvb/dvb-usb/af9005.c Luca Olivetti 2007-05-07 960 int *cold)
af4e067e1dcf92 drivers/media/dvb/dvb-usb/af9005.c Luca Olivetti 2007-05-07 961 {
af4e067e1dcf92 drivers/media/dvb/dvb-usb/af9005.c Luca Olivetti 2007-05-07 962 int ret;
c58b84ee467bfd drivers/media/usb/dvb-usb/af9005.c Mauro Carvalho Chehab 2016-10-05 963 u8 reply, *buf;
c58b84ee467bfd drivers/media/usb/dvb-usb/af9005.c Mauro Carvalho Chehab 2016-10-05 964
c58b84ee467bfd drivers/media/usb/dvb-usb/af9005.c Mauro Carvalho Chehab 2016-10-05 965 buf = kmalloc(FW_BULKOUT_SIZE + 2, GFP_KERNEL);
c58b84ee467bfd drivers/media/usb/dvb-usb/af9005.c Mauro Carvalho Chehab 2016-10-05 966 if (!buf)
c58b84ee467bfd drivers/media/usb/dvb-usb/af9005.c Mauro Carvalho Chehab 2016-10-05 967 return -ENOMEM;
c58b84ee467bfd drivers/media/usb/dvb-usb/af9005.c Mauro Carvalho Chehab 2016-10-05 968
c58b84ee467bfd drivers/media/usb/dvb-usb/af9005.c Mauro Carvalho Chehab 2016-10-05 969 ret = af9005_boot_packet(udev, FW_CONFIG, &reply,
c58b84ee467bfd drivers/media/usb/dvb-usb/af9005.c Mauro Carvalho Chehab 2016-10-05 970 buf, FW_BULKOUT_SIZE + 2);
af4e067e1dcf92 drivers/media/dvb/dvb-usb/af9005.c Luca Olivetti 2007-05-07 971 if (ret)
c58b84ee467bfd drivers/media/usb/dvb-usb/af9005.c Mauro Carvalho Chehab 2016-10-05 972 goto err;
af4e067e1dcf92 drivers/media/dvb/dvb-usb/af9005.c Luca Olivetti 2007-05-07 973 deb_info("result of FW_CONFIG in identify state %d\n", reply);
af4e067e1dcf92 drivers/media/dvb/dvb-usb/af9005.c Luca Olivetti 2007-05-07 974 if (reply == 0x01)
af4e067e1dcf92 drivers/media/dvb/dvb-usb/af9005.c Luca Olivetti 2007-05-07 975 *cold = 1;
af4e067e1dcf92 drivers/media/dvb/dvb-usb/af9005.c Luca Olivetti 2007-05-07 976 else if (reply == 0x02)
af4e067e1dcf92 drivers/media/dvb/dvb-usb/af9005.c Luca Olivetti 2007-05-07 977 *cold = 0;
af4e067e1dcf92 drivers/media/dvb/dvb-usb/af9005.c Luca Olivetti 2007-05-07 978 else
2289adbfa55905 drivers/media/usb/dvb-usb/af9005.c Navid Emamdoost 2019-10-09 979 ret = -EIO;
2289adbfa55905 drivers/media/usb/dvb-usb/af9005.c Navid Emamdoost 2019-10-09 980 if (!ret)
af4e067e1dcf92 drivers/media/dvb/dvb-usb/af9005.c Luca Olivetti 2007-05-07 @981 deb_info("Identify state cold = %d\n", *cold);
c58b84ee467bfd drivers/media/usb/dvb-usb/af9005.c Mauro Carvalho Chehab 2016-10-05 982
c58b84ee467bfd drivers/media/usb/dvb-usb/af9005.c Mauro Carvalho Chehab 2016-10-05 983 err:
c58b84ee467bfd drivers/media/usb/dvb-usb/af9005.c Mauro Carvalho Chehab 2016-10-05 984 kfree(buf);
c58b84ee467bfd drivers/media/usb/dvb-usb/af9005.c Mauro Carvalho Chehab 2016-10-05 985 return ret;
af4e067e1dcf92 drivers/media/dvb/dvb-usb/af9005.c Luca Olivetti 2007-05-07 986 }
af4e067e1dcf92 drivers/media/dvb/dvb-usb/af9005.c Luca Olivetti 2007-05-07 987

:::::: The code at line 981 was first introduced by commit
:::::: af4e067e1dcf926d9523dff11e46c45fd9fa9da2 V4L/DVB (5625): Add support for the AF9005 demodulator from Afatech

:::::: TO: Luca Olivetti <luca@xxxxxxxxxxx>
:::::: CC: Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip