drivers/sensors: release rpmsg resource when register_driver failed

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
dongjiuzhu1 2024-04-30 10:01:30 +08:00 committed by Xiang Xiao
parent fcf2eb8fcb
commit 7a8d58bf1b

View file

@ -1329,7 +1329,7 @@ int sensor_custom_register(FAR struct sensor_lowerhalf_s *lower,
if (lower == NULL)
{
ret = -EIO;
goto drv_err;
goto rpmsg_err;
}
#endif
@ -1345,6 +1345,11 @@ int sensor_custom_register(FAR struct sensor_lowerhalf_s *lower,
return ret;
drv_err:
#ifdef CONFIG_SENSORS_RPMSG
sensor_rpmsg_unregister(lower);
rpmsg_err:
#endif
nxrmutex_destroy(&upper->lock);
kmm_free(upper);