Device 'xilinx-keypad' does not have a release() function, it is broken and must be fixed.
2018-02-28 13:32
816 查看
简介
用platform_device_register()注册的设备,卸载驱动模块的时候会报下面的错误.Device 'xilinx-keypad' does not have a release() function, it is broken and must be fixed.
原因
//https://elixir.bootlin.com/linux/v4.1/source/drivers/base/core.c /** * device_release - free device structure. * @kobj: device's kobject. * * This is called once the reference count for the object * reaches 0. We forward the call to the device's release * method, which should handle actually freeing the structure. */ static void device_release(struct kobject *kobj) { struct device *dev = kobj_to_dev(kobj); struct device_private *p = dev->p; /* * Some platform devices are driven without driver attached * and managed resources may have been acquired. Make sure * all resources are released. * * Drivers still can add resources into device after device * is deleted but alive, so release devres here to avoid * possible memory leak. */ devres_release_all(dev); if (dev->release) dev->release(dev); else if (dev->type && dev->type->release) dev->type->release(dev); else if (dev->class && dev->class->dev_release) dev->class->dev_release(dev); else WARN(1, KERN_ERR "Device '%s' does not have a release() " "function, it is broken and must be fixed.\n", dev_name(dev)); kfree(p); }
原因是 platform_device->device -> release 没有初始化
解决方案
使用platform_device_alloc() , platform_device_add()替代platform_device_register()去添加设备,如果使用platform_device_register()添加设备需要自己实现
platform_device->device -> release,3.+以上的内核使用设备树管理设备,除测试外尽量少用这种代码添加的方式.
引用
https://stackoverflow.com/questions/15532170/device-has-no-release-function-what-does-this-meanhttp://blog.csdn.net/x356982611/article/details/79399371
相关文章推荐
- Shrio : This subject is anonymous - it does not have any identifying principals and
- The function must be used with a prefix when a default namespace is not specified
- tslib: Selected device is not a touchscreen (must support ABS and KEY event types)解决方法
- warning: the 'gets' function is dangerous and should not be used.的解决办法
- 关于The function equals must be used with a prefix when a default namespace is not specified解决
- The function equals must be used with a prefix when a default namespace is not specified解决
- warning: the 'gets' function is dangerous and should not be used.的解决办法
- 错误-Android-OpenCV-It seems that your device does not support camera(or it is locked)
- 警告: Scene is unreachable due to lack of entry points and does not have an identifier for runtime acc
- warning: the gets function is dangerous and should not be used.
- Web Service调用Nhibernate数据访问异常:xx cannot be serialized because it does not have a parameterless constructor
- The disk cannot be added to Cluster Shared Volumes because it does not have any suitable partitions
- Web Service调用Nhibernate数据访问异常:xx cannot be serialized because it does not have a parameterless constructor
- tomcat 7 WARNING: A context path must either be an empty string or start with a '/' and do not end with a '/'. The path [/] does not meet these criteria and has been changed to []
- Actionscript Error: declaration must be contained within the <Declarations> tag, since it is not ass
- The function getUserId must be used with a prefix when a default namespace is not specified 解决办法
- warning: the 'gets' function is dangerous and should not be used.的解决办法
- The function getUserId must be used with a prefix when a default namespace is not specified 解决办法
- Web Service调用Nhibernate数据访问异常:xx cannot be serialized because it does not have a parameterless constructor
- Class is not a root resource. It, or one of its interfaces must be annotated with @Path: