Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F164231151
D58432.id182601.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1007 B
Referenced Files
None
Subscribers
None
D58432.id182601.diff
View Options
diff --git a/sys/dev/hid/ietp.c b/sys/dev/hid/ietp.c
--- a/sys/dev/hid/ietp.c
+++ b/sys/dev/hid/ietp.c
@@ -450,13 +450,10 @@
{
device_t iichid = device_get_parent(parent);
static const uint16_t reg = IETP_PATTERN;
- uint16_t addr = iicbus_get_addr(iichid) << 1;
+ uint16_t addr;
uint8_t resp[2];
uint8_t cmd[2] = { reg & 0xff, (reg >> 8) & 0xff };
- struct iic_msg msgs[2] = {
- { addr, IIC_M_WR | IIC_M_NOSTOP, sizeof(cmd), cmd },
- { addr, IIC_M_RD, sizeof(resp), resp },
- };
+ struct iic_msg msgs[2];
struct iic_rdwr_data ird = { msgs, nitems(msgs) };
uint8_t pattern;
@@ -466,6 +463,10 @@
if (device_get_devclass(iichid) != devclass_find("iichid"))
return;
+ addr = iicbus_get_addr(iichid) << 1;
+ msgs[0] = (struct iic_msg){ addr, IIC_M_WR | IIC_M_NOSTOP, sizeof(cmd), cmd };
+ msgs[1] = (struct iic_msg){ addr, IIC_M_RD, sizeof(resp), resp };
+
DPRINTF("Read reg 0x%04x with size %zu\n", reg, sizeof(resp));
if (hid_ioctl(parent, I2CRDWR, (uintptr_t)&ird) != 0)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 30, 9:43 PM (8 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35472517
Default Alt Text
D58432.id182601.diff (1007 B)
Attached To
Mode
D58432: ietp: guard iicbus_get_addr with devclass check
Attached
Detach File
Event Timeline
Log In to Comment