Skip to content
Commit c84eab58 authored by Xiaoke Wang's avatar Xiaoke Wang Committed by Andy Shevchenko
Browse files

gpio: merrifield: check the return value of devm_kstrdup()



devm_kstrdup() returns pointer to allocated string on success, NULL on
failure. So it is better to check the return value of it.

Before, if devm_kstrdup() fails, pinctrl_dev_name will be NULL, then the
retval below will be a negative error-code (inside gpiochip_add_pin_range(),
pinctrl_find_and_add_gpio_range()->get_pinctrl_dev_from_devname() will
finally check pinctrl_dev_name and return an error), so the failure of
devm_kstrdup() can be only implicitly caught after a long call chain.

While this patch is to explicitly catch the failure in time.

Signed-off-by: default avatarXiaoke Wang <xkernel.wang@foxmail.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent 06608bc2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment