Fix GETMRL's logic

-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEKmCqpbOU668PNA69Ze02AX4ItwAFAl7UsosACgkQZe02AX4I
 twA+NQ/+IwWvESjPbdDKLj9Gifez7+c4CWBAAJ112AdYiOEKbOUbPYNpgr4xugk0
 RzWjBKVrmwMaOwcNWXPT10MJvKEKjGhIyObbPfkxjVLr+zZsRPJLPR72xc2igcA1
 moz20B9KF7osn0OxHfB5+SOu9Cl6GCS+8/ZnRQm4dOkmNFREEZAfzCbk5bOHdWwa
 74kfGI8OGYpp53WEDA8CJy9hPWgpZEKOUaQ5hQlX4+v8sm/FG9HWtoGADz44z3Dr
 mgd8J77IsKwywBXhTEWbx1g+PYwAWrL5i4BggNIhJ5Z72Tu3h5AGmCSJydGkYB6j
 08cJGqNvVpnCtaqPHUgvXKatUCZe3JELmr0D/k2o7nuM1T52iOEaWqXruRuhyYw4
 lFnbWEO5oM1VO/aKY5Si+3RoGe36DK83fe7HnFzH0spMe37gFpYioQD1YHoVpEVS
 q973naU+ub3td1y6FNgvmuT6HkdP5fHZg2V7x1Hx8htqbUa5QF9hS+3xeLE6nsXr
 ftYKhz7nmSxfTWZcnEvkFtjKLM0UYYp8uN6DYJYeazdS2TMAY1sibFm7pfRzBM1Y
 y+QSjiHrP1FdQW6tmmYXXbrCf4SsNKFQlXFRMu9nxMaG7QDHcpTWsZz6PiPOn6L+
 rsAAhWLJkIr1oUTqHYNIP71GIC4zPbTB5m1kaNEuLn/IOlJMWsw=
 =Bk7U
 -----END PGP SIGNATURE-----

Merge tag 'i3c/for-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/i3c/linux

Pull i3c update from Boris Brezillon:
 "Fix GETMRL's logic"

* tag 'i3c/for-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/i3c/linux:
  i3c master: GETMRL's 3rd byte is optional even with BCR_IBI_PAYLOAD
This commit is contained in:
Linus Torvalds 2020-06-01 11:53:50 -07:00
commit 729ea4e064
1 changed files with 8 additions and 8 deletions

View File

@ -1008,7 +1008,6 @@ static int i3c_master_getmrl_locked(struct i3c_master_controller *master,
struct i3c_device_info *info)
{
struct i3c_ccc_cmd_dest dest;
unsigned int expected_len;
struct i3c_ccc_mrl *mrl;
struct i3c_ccc_cmd cmd;
int ret;
@ -1024,22 +1023,23 @@ static int i3c_master_getmrl_locked(struct i3c_master_controller *master,
if (!(info->bcr & I3C_BCR_IBI_PAYLOAD))
dest.payload.len -= 1;
expected_len = dest.payload.len;
i3c_ccc_cmd_init(&cmd, true, I3C_CCC_GETMRL, &dest, 1);
ret = i3c_master_send_ccc_cmd_locked(master, &cmd);
if (ret)
goto out;
if (dest.payload.len != expected_len) {
switch (dest.payload.len) {
case 3:
info->max_ibi_len = mrl->ibi_len;
fallthrough;
case 2:
info->max_read_len = be16_to_cpu(mrl->read_len);
break;
default:
ret = -EIO;
goto out;
}
info->max_read_len = be16_to_cpu(mrl->read_len);
if (info->bcr & I3C_BCR_IBI_PAYLOAD)
info->max_ibi_len = mrl->ibi_len;
out:
i3c_ccc_cmd_dest_cleanup(&dest);