mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-19 04:02:05 +00:00
dm: virtio-i2c: minor fix
Change the condition of checking native adapter number. Change sprintf to snprintf. Tracked-On: #3437 Signed-off-by: Conghui Chen <conghui.chen@intel.com> Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
This commit is contained in:
parent
d28264ff56
commit
c1b4121e3b
@ -443,7 +443,7 @@ native_adapter_create(int bus, uint16_t slave_addr[], int n_slave)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(native_path, "/dev/i2c-%d", bus);
|
snprintf(native_path, sizeof(native_path), "/dev/i2c-%d", bus);
|
||||||
fd = open(native_path, O_RDWR);
|
fd = open(native_path, O_RDWR);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
WPRINTF("virtio_i2c: failed to open %s\n", native_path);
|
WPRINTF("virtio_i2c: failed to open %s\n", native_path);
|
||||||
@ -645,7 +645,7 @@ virtio_i2c_parse(struct virtio_i2c *vi2c, char *optstr)
|
|||||||
}
|
}
|
||||||
cp = t;
|
cp = t;
|
||||||
}
|
}
|
||||||
if (n_adapter > MAX_NATIVE_I2C_ADAPTER) {
|
if (n_adapter >= MAX_NATIVE_I2C_ADAPTER) {
|
||||||
WPRINTF("too many adapter, only support %d \n", MAX_NATIVE_I2C_ADAPTER);
|
WPRINTF("too many adapter, only support %d \n", MAX_NATIVE_I2C_ADAPTER);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user