mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 12:08:36 +08:00
drivers/sensors: release rpmsg resource when register_driver failed
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
fcf2eb8fcb
commit
7a8d58bf1b
1 changed files with 6 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue