diff --git a/components/drivers/misc/rt_drv_pwm.c b/components/drivers/misc/rt_drv_pwm.c index 5c59b4fc697..ef08048207d 100644 --- a/components/drivers/misc/rt_drv_pwm.c +++ b/components/drivers/misc/rt_drv_pwm.c @@ -116,7 +116,9 @@ rt_err_t rt_device_pwm_register(struct rt_device_pwm *device, const char *name, { rt_err_t result = RT_EOK; +#ifndef RT_USING_DM rt_memset(device, 0, sizeof(struct rt_device_pwm)); +#endif #ifdef RT_USING_DEVICE_OPS device->parent.ops = &pwm_device_ops;