mirror of https://gitee.com/openkylin/qemu.git
i2c: pm_smbus: Make the I2C block read command read-only
It did have write capability, but the manual says the behavior with write enabled is undefined. So just set an error in this case. Signed-off-by: Corey Minyard <cminyard@mvista.com> Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <1534796770-10295-4-git-send-email-minyard@acm.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
4b615be540
commit
00bdfeab15
|
@ -55,7 +55,7 @@
|
||||||
#define PROT_WORD_DATA 3
|
#define PROT_WORD_DATA 3
|
||||||
#define PROT_PROC_CALL 4
|
#define PROT_PROC_CALL 4
|
||||||
#define PROT_BLOCK_DATA 5
|
#define PROT_BLOCK_DATA 5
|
||||||
#define PROT_I2C_BLOCK_DATA 6
|
#define PROT_I2C_BLOCK_READ 6
|
||||||
|
|
||||||
/*#define DEBUG*/
|
/*#define DEBUG*/
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ static void smb_transaction(PMSMBus *s)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROT_I2C_BLOCK_DATA:
|
case PROT_I2C_BLOCK_READ:
|
||||||
if (read) {
|
if (read) {
|
||||||
int xfersize = s->smb_data0;
|
int xfersize = s->smb_data0;
|
||||||
if (xfersize > sizeof(s->smb_data)) {
|
if (xfersize > sizeof(s->smb_data)) {
|
||||||
|
@ -125,9 +125,8 @@ static void smb_transaction(PMSMBus *s)
|
||||||
xfersize, false, true);
|
xfersize, false, true);
|
||||||
goto data8;
|
goto data8;
|
||||||
} else {
|
} else {
|
||||||
ret = smbus_write_block(bus, addr, cmd, s->smb_data, s->smb_data0,
|
/* The manual says the behavior is undefined, just set DEV_ERR. */
|
||||||
false);
|
goto error;
|
||||||
goto done;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue