Skip to content

Commit

Permalink
HID: alps: Check errors returned by 't4_read_write_register()'
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christophe JAILLET authored and Jiri Kosina committed Apr 26, 2018
1 parent edb6cb3 commit 6993401
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions drivers/hid/hid-alps.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 6993401

Please sign in to comment.