]> git.baikalelectronics.ru Git - kernel.git/commit
of: do not leak console options
authorSergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Tue, 26 Sep 2017 06:25:10 +0000 (15:25 +0900)
committerRob Herring <robh@kernel.org>
Thu, 12 Oct 2017 17:22:04 +0000 (12:22 -0500)
commit3401972d972eea98294ee40d2d4d86bdbfbfb584
tree1fd0391e582a81d8a3a6d34872a4d0eed3a67118
parentfb8141d6423a2379f3dbd29ab43279906f1659cd
of: do not leak console options

Do not strdup() console options. It seems that the only reason for
it to be strdup()-ed was a compilation warning: printk, UART and
console drivers, for some reason, expect char pointer instead of
const char pointer. So we can just pass `of_stdout_options', but
need to cast it to char pointer. A better fix would be to change
printk, console drivers and UART to accept const char `options';
but that will take time - there are lots of drivers to update.

The patch also fixes a possible memory leak: add_preferred_console()
can fail, but we don't kfree() options.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Rob Herring <robh@kernel.org>
drivers/of/base.c