drm/tinydrm: mipi-dbi: Silence: ‘cmd’ may be used uninitialized
authorNoralf Trønnes <noralf@tronnes.org>
Thu, 23 Feb 2017 13:29:55 +0000 (14:29 +0100)
committerDave Airlie <airlied@redhat.com>
Fri, 24 Feb 2017 02:08:58 +0000 (12:08 +1000)
Fix this warning:
drivers/gpu/drm/tinydrm/mipi-dbi.c: In function ‘mipi_dbi_debugfs_command_write’:
drivers/gpu/drm/tinydrm/mipi-dbi.c:905:8: warning: ‘cmd’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  ret = mipi_dbi_command_buf(mipi, cmd, parameters, i);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cmd can't be used uninitialized, but to satisfy the compiler,
initialize it to zero.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/tinydrm/mipi-dbi.c

index 07d49ba78d8e6fe2ef330cb6a70baf834d4acf74..2caecdea7ab3ca4eccad82292fd284b85f00967d 100644 (file)
@@ -863,7 +863,7 @@ static ssize_t mipi_dbi_debugfs_command_write(struct file *file,
 {
        struct seq_file *m = file->private_data;
        struct mipi_dbi *mipi = m->private;
-       u8 val, cmd, parameters[64];
+       u8 val, cmd = 0, parameters[64];
        char *buf, *pos, *token;
        unsigned int i;
        int ret;