aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2020-06-01 11:53:50 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2020-06-01 11:53:50 -0700
commit729ea4e064202aeec149b034b459501ef0a5060e (patch)
treef276788fb2834235a3d0200c4a4955e4cd89958c
parentd30fc97c60682f9bf5d6898ab370de0007e96742 (diff)
parentb4203ce0556348dcfe29f897d1dbe65102874d89 (diff)
downloadlinux-stable-729ea4e064202aeec149b034b459501ef0a5060e.tar.gz
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
-rw-r--r--drivers/i3c/master.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index d79cd6d54b3a7c..97f2e29265da78 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -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);