On Tue, Sep 11, 2018 at 12:11:23PM +0300, Alexey Skidanov wrote:
> 
> 
> On 09/11/2018 11:59 AM, Greg KH wrote:
> > On Tue, Sep 11, 2018 at 11:50:19AM +0300, Dan Carpenter wrote:
> >> On Tue, Sep 11, 2018 at 11:17:10AM +0300, Alexey Skidanov wrote:
> >>> @@ -546,6 +556,38 @@ void ion_device_add_heap(struct ion_heap *heap)
> >>>   }
> >>>  
> >>>   heap->dev = dev;
> >>> + heap->num_of_buffers = 0;
> >>> + heap->num_of_alloc_bytes = 0;
> >>> + heap->alloc_bytes_wm = 0;
> >>> +
> >>> + /* Create heap root directory. If creation is failed, we may continue */
> >>> + heap_root = debugfs_create_dir(heap->name, dev->debug_root);
> >>> + if (!IS_ERR_OR_NULL(heap_root)) {
> >>
> >> Just remove this check.  If debugfs_create_dir() fails, it doesn't
> >> cause any problems here.
> If debugfs_create_dir fails, the heap_root will be either NULL (and thus
> the underlying files will be created under /sys/kernel/debug) or -EXXX
> (and thus we probably crash the Kernel). Am I wrong?

If the result is NULL, then something bad is wrong with debugfs, so any
future calls will also fail, no need to worry.

If -ENODEV returns, then you can pass that into a future debugfs call
just fine as well, all is good.

> > I asked for that to be done last time :(
> What exactly?

I asked that you not check the return value of the debugfs call, it's
explicitly designed to not need to do this.  Don't do extra work for no
reason :)

thanks,

greg k-h
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to