iio: amplifiers: ad8366: Change devm_gpiod_get() to optional and add the missed check
authorChuhong Yuan <hslester96@gmail.com>
Wed, 3 Jun 2020 09:26:10 +0000 (17:26 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Aug 2020 06:23:46 +0000 (08:23 +0200)
commita6abea0032aaecfb35b11baa2533d19d319c81c7
tree97284f0b4f0d322001fc297602874f2eee67b5fc
parentf616ff202deb590a74be3678904d145b7fb64e80
iio: amplifiers: ad8366: Change devm_gpiod_get() to optional and add the missed check

[ Upstream commit 9ca39411f9a9c833727750431da8dfd96ff80005 ]

Since if there is no GPIO, nothing happens, replace devm_gpiod_get()
with devm_gpiod_get_optional().
Also add IS_ERR() to fix the missing-check warning.

Fixes: cee211f4e5a0 ("iio: amplifiers: ad8366: Add support for the ADA4961 DGA")
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Acked-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/amplifiers/ad8366.c