[HUST CSE][vbus] fix the NULL pointer error
This commit is contained in:
parent
9a432c7413
commit
ca023c1b41
|
@ -231,13 +231,14 @@ void rt_vbus_chnx_register_disconn(rt_device_t dev,
|
||||||
rt_vbus_event_listener indi,
|
rt_vbus_event_listener indi,
|
||||||
void *ctx)
|
void *ctx)
|
||||||
{
|
{
|
||||||
struct rt_vbus_dev *vdev = dev->user_data;
|
if (dev && dev->user_data)
|
||||||
|
{
|
||||||
|
struct rt_vbus_dev *vdev = dev->user_data;
|
||||||
|
RT_ASSERT(vdev->chnr != 0);
|
||||||
|
|
||||||
RT_ASSERT(vdev->chnr != 0);
|
|
||||||
|
|
||||||
if (vdev)
|
|
||||||
rt_vbus_register_listener(vdev->chnr, RT_VBUS_EVENT_ID_DISCONN,
|
rt_vbus_register_listener(vdev->chnr, RT_VBUS_EVENT_ID_DISCONN,
|
||||||
indi, ctx);
|
indi, ctx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
|
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
|
||||||
|
|
Loading…
Reference in New Issue