OSDN Git Service

gpio: mockup: dynamically allocate memory for chip name
authorBartosz Golaszewski <bgolaszewski@baylibre.com>
Tue, 20 Dec 2016 11:28:19 +0000 (12:28 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 28 Dec 2016 13:12:51 +0000 (14:12 +0100)
commitad6d8004fa29a8958381b60215e32d1e903b0492
tree5e059a240bc3e8a0e50580194d2181bbbbdce467
parente53c60289dfaba57fd8bf108406b94a71bb9bac1
gpio: mockup: dynamically allocate memory for chip name

Currently the chip name buffer is allocated on the stack and the
address of the buffer is passed to the gpio framework. It's invalid
after probe() returns, so the sysfs label attribute displays garbage.

Use devm_kasprintf() for each string instead.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-mockup.c