Skip to content

Commit 729ea4e

Browse files
committed
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
2 parents d30fc97 + b4203ce commit 729ea4e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/i3c/master.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,6 @@ static int i3c_master_getmrl_locked(struct i3c_master_controller *master,
10081008
struct i3c_device_info *info)
10091009
{
10101010
struct i3c_ccc_cmd_dest dest;
1011-
unsigned int expected_len;
10121011
struct i3c_ccc_mrl *mrl;
10131012
struct i3c_ccc_cmd cmd;
10141013
int ret;
@@ -1024,22 +1023,23 @@ static int i3c_master_getmrl_locked(struct i3c_master_controller *master,
10241023
if (!(info->bcr & I3C_BCR_IBI_PAYLOAD))
10251024
dest.payload.len -= 1;
10261025

1027-
expected_len = dest.payload.len;
10281026
i3c_ccc_cmd_init(&cmd, true, I3C_CCC_GETMRL, &dest, 1);
10291027
ret = i3c_master_send_ccc_cmd_locked(master, &cmd);
10301028
if (ret)
10311029
goto out;
10321030

1033-
if (dest.payload.len != expected_len) {
1031+
switch (dest.payload.len) {
1032+
case 3:
1033+
info->max_ibi_len = mrl->ibi_len;
1034+
fallthrough;
1035+
case 2:
1036+
info->max_read_len = be16_to_cpu(mrl->read_len);
1037+
break;
1038+
default:
10341039
ret = -EIO;
10351040
goto out;
10361041
}
10371042

1038-
info->max_read_len = be16_to_cpu(mrl->read_len);
1039-
1040-
if (info->bcr & I3C_BCR_IBI_PAYLOAD)
1041-
info->max_ibi_len = mrl->ibi_len;
1042-
10431043
out:
10441044
i3c_ccc_cmd_dest_cleanup(&dest);
10451045

0 commit comments

Comments
 (0)