mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-02-22 01:15:26 +08:00
Merge pull request #3433 from DavidLin1577/patch-5
Fixed a hidden stack overflow bug
This commit is contained in:
commit
a7bcf90d78
@ -29,6 +29,7 @@
|
|||||||
#include "interrupt.h"
|
#include "interrupt.h"
|
||||||
#include "board_info.h"
|
#include "board_info.h"
|
||||||
#include "inc/fh_driverlib.h"
|
#include "inc/fh_driverlib.h"
|
||||||
|
#include <rtthread.h>
|
||||||
#include <rtdevice.h>
|
#include <rtdevice.h>
|
||||||
#ifdef FH_PWM_DEBUG
|
#ifdef FH_PWM_DEBUG
|
||||||
#define PRINT_PWM_DBG(fmt, args...) \
|
#define PRINT_PWM_DBG(fmt, args...) \
|
||||||
@ -185,14 +186,14 @@ int fh_pwm_probe(void *priv_data)
|
|||||||
|
|
||||||
PWM_Enable(pwm_obj, RT_FALSE);
|
PWM_Enable(pwm_obj, RT_FALSE);
|
||||||
|
|
||||||
pwm_dev = rt_malloc(sizeof(struct rt_device));
|
pwm_dev = rt_calloc(1,sizeof(struct rt_device));
|
||||||
rt_memset(pwm_dev, 0, sizeof(struct rt_device));
|
|
||||||
|
|
||||||
if (pwm_dev == RT_NULL)
|
if (pwm_dev == RT_NULL)
|
||||||
{
|
{
|
||||||
rt_kprintf("ERROR: %s rt_device malloc failed\n", __func__);
|
rt_kprintf("ERROR: %s rt_device calloc failed\n", __func__);
|
||||||
|
return -RT_ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
pwm_dev->user_data = &pwm_drv;
|
pwm_dev->user_data = &pwm_drv;
|
||||||
pwm_dev->open =fh_pwm_open;
|
pwm_dev->open =fh_pwm_open;
|
||||||
pwm_dev->close = fh_pwm_close;
|
pwm_dev->close = fh_pwm_close;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user