platform/x86: surface3_button: Propagate error from gpiod_count()

Since gpiod_count() does not return 0 anymore, we don't need to shadow
its error code and would safely propagate to the user.

While here, replace second parameter by NULL in order to prevent side
effects on _DSD enabled firmware.

Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
Andy Shevchenko 2017-02-20 18:15:48 +02:00 коммит произвёл Linus Walleij
Родитель 4033d4a4f5
Коммит 562e7a4032
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -196,9 +196,10 @@ static int surface3_button_probe(struct i2c_client *client,
strlen(SURFACE_BUTTON_OBJ_NAME))) strlen(SURFACE_BUTTON_OBJ_NAME)))
return -ENODEV; return -ENODEV;
if (gpiod_count(dev, KBUILD_MODNAME) <= 0) { error = gpiod_count(dev, NULL);
if (error < 0) {
dev_dbg(dev, "no GPIO attached, ignoring...\n"); dev_dbg(dev, "no GPIO attached, ignoring...\n");
return -ENODEV; return error;
} }
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);