rk808: fix a err when no sleep pin in dts

Rk808 will data abort if it has not sleep gpio in dts, and there is no
pmic_sleep_gpio for some board, add a validity checking before
gpio_request can fix this data abort.

Change-Id: Ic2b40f7bfb00e95d283dce72a33dd844cc2c7e27
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
This commit is contained in:
Chris Zhong
2015-08-26 17:54:55 +08:00
committed by Gerrit Code Review
parent 927209616e
commit 83e9a56bb1

View File

@@ -1399,7 +1399,7 @@ static int rk808_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *i
/******************************set sleep vol & dcdc mode******************/
#ifdef CONFIG_OF
rk808->pmic_sleep_gpio = pdev->pmic_sleep_gpio;
if (rk808->pmic_sleep_gpio) {
if (gpio_is_valid(rk808->pmic_sleep_gpio)) {
ret = gpio_request(rk808->pmic_sleep_gpio, "rk808_pmic_sleep");
if (ret < 0) {
dev_err(rk808->dev,"Failed to request gpio %d with ret:""%d\n", rk808->pmic_sleep_gpio, ret);