From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-media@vger.kernel.org,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 7/7] media: usb: uvc: no need to check return value of debugfs_create functions
Date: Thu, 17 Sep 2020 15:25:50 +0300 [thread overview]
Message-ID: <20200917122550.GA5053@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20200818234719.GD2360@pendragon.ideasonboard.com>
Hi Greg,
On Wed, Aug 19, 2020 at 02:47:19AM +0300, Laurent Pinchart wrote:
> Hi Greg,
>
> Thank you for the patch.
>
> On Tue, Aug 18, 2020 at 03:36:08PM +0200, Greg Kroah-Hartman wrote:
> > When calling debugfs functions, there is no need to ever check the
> > return value. The function can work or not, but the code logic should
> > never do something different based on this.
>
> Is there no value in warning the user that something went wrong ? Silent
> failures are harder to debug.
Could yous share your opinion about this ?
> > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> > Cc: linux-media@vger.kernel.org
> > Cc: linux-kernel@vger.kernel.org
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> > drivers/media/usb/uvc/uvc_debugfs.c | 20 ++++----------------
> > 1 file changed, 4 insertions(+), 16 deletions(-)
> >
> > diff --git a/drivers/media/usb/uvc/uvc_debugfs.c b/drivers/media/usb/uvc/uvc_debugfs.c
> > index 2b8af4b54117..1a1258d4ffca 100644
> > --- a/drivers/media/usb/uvc/uvc_debugfs.c
> > +++ b/drivers/media/usb/uvc/uvc_debugfs.c
> > @@ -73,7 +73,6 @@ static struct dentry *uvc_debugfs_root_dir;
> > void uvc_debugfs_init_stream(struct uvc_streaming *stream)
> > {
> > struct usb_device *udev = stream->dev->udev;
> > - struct dentry *dent;
> > char dir_name[33];
> >
> > if (uvc_debugfs_root_dir == NULL)
> > @@ -82,22 +81,11 @@ void uvc_debugfs_init_stream(struct uvc_streaming *stream)
> > snprintf(dir_name, sizeof(dir_name), "%u-%u-%u", udev->bus->busnum,
> > udev->devnum, stream->intfnum);
> >
> > - dent = debugfs_create_dir(dir_name, uvc_debugfs_root_dir);
> > - if (IS_ERR_OR_NULL(dent)) {
> > - uvc_printk(KERN_INFO, "Unable to create debugfs %s "
> > - "directory.\n", dir_name);
> > - return;
> > - }
> > -
> > - stream->debugfs_dir = dent;
> > + stream->debugfs_dir = debugfs_create_dir(dir_name,
> > + uvc_debugfs_root_dir);
> >
> > - dent = debugfs_create_file("stats", 0444, stream->debugfs_dir,
> > - stream, &uvc_debugfs_stats_fops);
> > - if (IS_ERR_OR_NULL(dent)) {
> > - uvc_printk(KERN_INFO, "Unable to create debugfs stats file.\n");
> > - uvc_debugfs_cleanup_stream(stream);
> > - return;
> > - }
> > + debugfs_create_file("stats", 0444, stream->debugfs_dir, stream,
> > + &uvc_debugfs_stats_fops);
> > }
> >
> > void uvc_debugfs_cleanup_stream(struct uvc_streaming *stream)
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2020-09-17 12:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-18 13:36 [PATCH 1/7] media: cec: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2020-08-18 13:36 ` [PATCH 2/7] media: coda: " Greg Kroah-Hartman
2020-08-18 13:56 ` Philipp Zabel
2020-08-18 13:36 ` [PATCH 3/7] media: exynos4-is: " Greg Kroah-Hartman
2020-08-18 13:36 ` [PATCH 4/7] media: mtk-vpu: " Greg Kroah-Hartman
2020-08-18 13:36 ` [PATCH 5/7] media: sti: " Greg Kroah-Hartman
2020-08-18 13:36 ` [PATCH 6/7] media: radio: si476x: " Greg Kroah-Hartman
2020-08-18 13:36 ` [PATCH 7/7] media: usb: uvc: " Greg Kroah-Hartman
2020-08-18 23:47 ` Laurent Pinchart
2020-09-17 12:25 ` Laurent Pinchart [this message]
2020-09-17 12:34 ` Greg Kroah-Hartman
2020-09-17 12:37 ` Laurent Pinchart
2020-09-17 12:46 ` Greg Kroah-Hartman
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=20200917122550.GA5053@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox