Re: [PATCH] Remove deductively redundant NULL pointer checks

From: kbuild test robot
Date: Tue Feb 26 2019 - 03:02:04 EST


Hi Shaobo,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v5.0-rc8 next-20190225]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Shaobo-He/Remove-deductively-redundant-NULL-pointer-checks/20190226-133616
base: git://linuxtv.org/media_tree.git master
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 8.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=8.2.0 make.cross ARCH=xtensa

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

In file included from include/media/videobuf2-v4l2.h:16,
from include/media/v4l2-mem2mem.h:20,
from drivers/media//platform/vim2m.c:27:
drivers/media//platform/vim2m.c: In function 'vidioc_s_fmt':
>> include/media/videobuf2-core.h:1098:11: warning: 'vq' may be used uninitialized in this function [-Wmaybe-uninitialized]
return (q->num_buffers > 0);
~^~~~~~~~~~~~~
drivers/media//platform/vim2m.c:683:20: note: 'vq' was declared here
struct vb2_queue *vq;
^~
--
In file included from include/media/videobuf2-v4l2.h:16,
from include/media/v4l2-mem2mem.h:20,
from drivers/media/platform/vim2m.c:27:
drivers/media/platform/vim2m.c: In function 'vidioc_s_fmt':
>> include/media/videobuf2-core.h:1098:11: warning: 'vq' may be used uninitialized in this function [-Wmaybe-uninitialized]
return (q->num_buffers > 0);
~^~~~~~~~~~~~~
drivers/media/platform/vim2m.c:683:20: note: 'vq' was declared here
struct vb2_queue *vq;
^~

vim +/vq +1098 include/media/videobuf2-core.h

74753cff Hans Verkuil 2014-04-07 1089
74753cff Hans Verkuil 2014-04-07 1090 /**
2b141324 Mauro Carvalho Chehab 2017-10-06 1091 * vb2_is_busy() - return busy status of the queue.
2b141324 Mauro Carvalho Chehab 2017-10-06 1092 * @q: pointer to &struct vb2_queue with videobuf2 queue.
e23ccc0a Pawel Osciak 2010-10-11 1093 *
e23ccc0a Pawel Osciak 2010-10-11 1094 * This function checks if queue has any buffers allocated.
e23ccc0a Pawel Osciak 2010-10-11 1095 */
e23ccc0a Pawel Osciak 2010-10-11 1096 static inline bool vb2_is_busy(struct vb2_queue *q)
e23ccc0a Pawel Osciak 2010-10-11 1097 {
e23ccc0a Pawel Osciak 2010-10-11 @1098 return (q->num_buffers > 0);
e23ccc0a Pawel Osciak 2010-10-11 1099 }
e23ccc0a Pawel Osciak 2010-10-11 1100

:::::: The code at line 1098 was first introduced by commit
:::::: e23ccc0ad9258634e6d52cedf473b35dc34416c7 [media] v4l: add videobuf2 Video for Linux 2 driver framework

:::::: TO: Pawel Osciak <p.osciak@xxxxxxxxxxx>
:::::: CC: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip