lkml.org 
[lkml]   [2012]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] usb: dwc3: debugfs: fix error check
On Tue, Jan 31, 2012 at 02:03:51PM +0200, Felipe Balbi wrote:
> debugfs APIs will return two different error
> values depending on the situation:
>
> -> if debugfs isn't enabled in the kernel:
> it will return -ENODEV
>
> -> if debugfs is enabled in the kernel:
> it will return NULL
>
> This means that blindly using IS_ERR() isn't
> enough and, in fact, will not work on a real
> error condition.
>
> While we could be checking for a NULL pointer
> only because we only compile and link debugfs.o
> when CONFIG_DEBUG_FS is enabled, we decided
> to play it safe should any of the debugfs rules
> change over time.

The rules should not change over time, and if they do, any in-kernel
users will be fixed up.

This shouldn't be that hard, just check for NULL and move on if an error
happens, don't mess with the IS_ERR() stuff at all.

Look at how the USB core handles this, and use that logic.

thanks,

greg k-h


\
 
 \ /
  Last update: 2012-01-31 15:57    [W:0.054 / U:0.536 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site