kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ellingsworth <david@identd.dyndns.org>
To: Dan Carpenter <error27@gmail.com>
Cc: "Mauro Carvalho Chehab" <mchehab@infradead.org>,
	"Dean Anderson" <dean@sensoray.com>,
	"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
	"Mike Isely" <isely@pobox.com>,
	"André Goddard Rosa" <andre.goddard@gmail.com>,
	linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] video/s255drv: cleanup. remove uneeded NULL check
Date: Mon, 29 Mar 2010 15:54:52 +0000	[thread overview]
Message-ID: <30353c3d1003290854s7a1a119cm5fdf8cf0142762df@mail.gmail.com> (raw)
In-Reply-To: <20100328112909.GP5069@bicker>

I don't have any problems with this patch in particular but would like
to note that this driver could use a little refactoring.

One thing I noticed just while glancing at the code is that the return
value from s2255_probe_v4l is not checked in s2255_probe. As a result
the driver could fail to register some or all of it's video device
nodes and still continue to load.

Also the use of kref, while needed in this driver due to the number of
video nodes created, is probably a bit overused. In my opinion
video_unregister_device should be called in the usb disconnect
callback for each registered video device. This ensures that no future
calls to open will occur for that device. Subsequently, once all
applications have stopped using the previously registered
video_device, the release callback of the video_device struct will
fire. Therefore if the device kref is incremented for each registered
video device (during probe) and then properly decremented during the
video_device release callback for each device the device driver's
structure may then be freed. This approach should lead to a much
cleaner implementation of the open, release, and disconnect callbacks.

Regards,

David Ellingsworth

      reply	other threads:[~2010-03-29 15:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-28 11:29 [patch] video/s255drv: cleanup. remove uneeded NULL check Dan Carpenter
2010-03-29 15:54 ` David Ellingsworth [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=30353c3d1003290854s7a1a119cm5fdf8cf0142762df@mail.gmail.com \
    --to=david@identd.dyndns.org \
    --cc=andre.goddard@gmail.com \
    --cc=dean@sensoray.com \
    --cc=error27@gmail.com \
    --cc=isely@pobox.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.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;
as well as URLs for NNTP newsgroup(s).