HID: alps: Check errors returned by 't4_read_write_register()'

If only the first 't4_read_write_register()' call fails, the error code
will be overwritten and lost.
Directly report the error instead.

While at it, log some errors if 't4_read_write_register()' fails, as done
in the rest of the driver.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
Christophe JAILLET 2018-03-19 21:53:28 +01:00 committed by Jiri Kosina
parent edb6cb3d7c
commit 69934012f3

View File

@ -460,17 +460,35 @@ static int __maybe_unused alps_post_reset(struct hid_device *hdev)
case T4:
ret = t4_read_write_register(hdev, T4_PRM_FEED_CONFIG_1,
NULL, T4_I2C_ABS, false);
if (ret < 0) {
dev_err(&hdev->dev, "failed T4_PRM_FEED_CONFIG_1 (%d)\n",
ret);
goto exit;
}
ret = t4_read_write_register(hdev, T4_PRM_FEED_CONFIG_4,
NULL, T4_FEEDCFG4_ADVANCED_ABS_ENABLE, false);
if (ret < 0) {
dev_err(&hdev->dev, "failed T4_PRM_FEED_CONFIG_4 (%d)\n",
ret);
goto exit;
}
break;
case U1:
ret = u1_read_write_register(hdev,
ADDRESS_U1_DEV_CTRL_1, NULL,
U1_TP_ABS_MODE | U1_SP_ABS_MODE, false);
if (ret < 0) {
dev_err(&hdev->dev, "failed to change TP mode (%d)\n",
ret);
goto exit;
}
break;
default:
break;
}
exit:
return ret;
}