Skip to contentSkip to conversation

tty: tty_io.c shadows sparse fix

PATCH New Jason Wessel 1 participant 1 message Sep 26, 2008 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tty: tty_io.c shadows sparse fix

Fix the problem reported by sparse:

drivers/char/tty_io.c:1413:17: warning: symbol 'buf' shadows an earlier one drivers/char/tty_io.c:1379:20: originally declared here

---
 drivers/char/tty_io.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/char/tty_io.c +4 -4
index daeb8f7..a155002 100644
@@ -1410,19 +1410,19 @@ static inline ssize_t do_tty_write(
 
 	/* write_buf/write_cnt is protected by the atomic_write_lock mutex */
 	if (tty->write_cnt < chunk) {
-		unsigned char *buf;
+		unsigned char *buf_chunk;
 
 		if (chunk < 1024)
 			chunk = 1024;
 
-		buf = kmalloc(chunk, GFP_KERNEL);
-		if (!buf) {
+		buf_chunk = kmalloc(chunk, GFP_KERNEL);
+		if (!buf_chunk) {
 			ret = -ENOMEM;
 			goto out;
 		}
 		kfree(tty->write_buf);
 		tty->write_cnt = chunk;
-		tty->write_buf = buf;
+		tty->write_buf = buf_chunk;
 	}
 
 	/* Do the write .. */
Signature · 1 line
1.6.0.90.g436ed.dirty