All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Felipe Balbi <balbi@ti.com>
Cc: Linux USB Mailing List <linux-usb@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] usb: dwc3: debugfs: fix error check
Date: Tue, 31 Jan 2012 06:53:32 -0800	[thread overview]
Message-ID: <20120131145332.GD27352@kroah.com> (raw)
In-Reply-To: <1328011431-25610-1-git-send-email-balbi@ti.com>

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

      reply	other threads:[~2012-01-31 14:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-31 12:03 [PATCH] usb: dwc3: debugfs: fix error check Felipe Balbi
2012-01-31 14:53 ` Greg KH [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120131145332.GD27352@kroah.com \
    --to=greg@kroah.com \
    --cc=balbi@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.