Re: [PATCH v6 1/2] tty: hvc: pass DMA capable memory to put_chars()

From: kernel test robot
Date: Thu Aug 12 2021 - 08:28:01 EST


Hi Xianting,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tty/tty-testing]
[also build test WARNING on char-misc/char-misc-testing soc/for-next v5.14-rc5 next-20210812]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Xianting-Tian/make-hvc-pass-dma-capable-memory-to-its-backend/20210812-174847
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
config: hexagon-randconfig-r041-20210812 (attached as .config)
compiler: clang version 12.0.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
# https://github.com/0day-ci/linux/commit/9f2925b5429149ceb0ea6eeaa8c81d422c3124fc
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Xianting-Tian/make-hvc-pass-dma-capable-memory-to-its-backend/20210812-174847
git checkout 9f2925b5429149ceb0ea6eeaa8c81d422c3124fc
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=hexagon

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

All warnings (new ones prefixed by >>):

>> drivers/tty/hvc/hvc_console.c:190:26: warning: variable 'hp' is uninitialized when used here [-Wuninitialized]
spin_unlock_irqrestore(&hp->c_lock, flags);
^~
drivers/tty/hvc/hvc_console.c:149:23: note: initialize the variable 'hp' to silence this warning
struct hvc_struct *hp;
^
= NULL
1 warning generated.


vim +/hp +190 drivers/tty/hvc/hvc_console.c

136
137 /*
138 * Console APIs, NOT TTY. These APIs are available immediately when
139 * hvc_console_setup() finds adapters.
140 */
141
142 static void hvc_console_print(struct console *co, const char *b,
143 unsigned count)
144 {
145 char *c;
146 unsigned i = 0, n = 0;
147 int r, donecr = 0, index = co->index;
148 unsigned long flags;
149 struct hvc_struct *hp;
150
151 /* Console access attempt outside of acceptable console range. */
152 if (index >= MAX_NR_HVC_CONSOLES)
153 return;
154
155 /* This console adapter was removed so it is not usable. */
156 if (vtermnos[index] == -1 || !cons_outbuf[index])
157 return;
158
159 c = cons_outbuf[index];
160
161 spin_lock_irqsave(&hp->c_lock, flags);
162 while (count > 0 || i > 0) {
163 if (count > 0 && i < sizeof(c)) {
164 if (b[n] == '\n' && !donecr) {
165 c[i++] = '\r';
166 donecr = 1;
167 } else {
168 c[i++] = b[n++];
169 donecr = 0;
170 --count;
171 }
172 } else {
173 r = cons_ops[index]->put_chars(vtermnos[index], c, i);
174 if (r <= 0) {
175 /* throw away characters on error
176 * but spin in case of -EAGAIN */
177 if (r != -EAGAIN) {
178 i = 0;
179 } else {
180 hvc_console_flush(cons_ops[index],
181 vtermnos[index]);
182 }
183 } else if (r > 0) {
184 i -= r;
185 if (i > 0)
186 memmove(c, c+r, i);
187 }
188 }
189 }
> 190 spin_unlock_irqrestore(&hp->c_lock, flags);
191 hvc_console_flush(cons_ops[index], vtermnos[index]);
192 }
193

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

Attachment: .config.gz
Description: application/gzip