public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Ronald Bultje <rbultje@ronald.bitfreak.net>
Cc: Pauline Middelink <middelink@polyware.nl>,
	linux-kernel@vger.kernel.org, kraxel@bytesex.org
Subject: Re: zr36120 2.6.x port (was: Re: [Mjpeg-users] DC30+ can't capture size greater than 224x168)
Date: Thu, 25 Sep 2003 17:10:10 +0100	[thread overview]
Message-ID: <20030925171010.A17271@infradead.org> (raw)
In-Reply-To: <1064505583.2228.716.camel@shrek.bitfreak.net>; from rbultje@ronald.bitfreak.net on Thu, Sep 25, 2003 at 05:59:44PM +0200

On Thu, Sep 25, 2003 at 05:59:44PM +0200, Ronald Bultje wrote:
> +	if (!try_module_get(THIS_MODULE)) {
> +		printk(KERN_ERR "failed to acquire lock on myself\n");
> +		return -EIO;
> +	}

This is broken, you need an owner outside the open routine.

> +
> +	/* find the device */
> +	for (i = 0; i < zoran_cards; i++) {
> +		if (zorans[i].video_dev->minor == minor) {
> +			ztv = &zorans[i];
> +			break;
> +		}
> +	}

What serializes this?

> +	if (ztv->have_decoder &&
> +	    !try_module_get(ztv->decoder->driver->owner)) {
> +		printk(KERN_ERR "Failed to acquire lock on TV decoder\n");
> +		module_put(THIS_MODULE);
> +		return -EIO;
> +	} 
> +	if (ztv->have_tuner &&
> +	    !try_module_get(ztv->tuner->driver->owner)) {
> +		printk(KERN_ERR "Failed to acquire lock on TV tuner\n");
> +		if (ztv->have_decoder)
> +			module_put(ztv->decoder->driver->owner);
> +		module_put(THIS_MODULE);
> +		return -EIO;
> +	}

You probably want to add a few gotos to unwind at the end of the
function with less code deuplication..


  reply	other threads:[~2003-09-25 16:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <BAY7-F62oStVwgTlLlJ0001924a@hotmail.com>
     [not found] ` <1064478814.2220.326.camel@shrek.bitfreak.net>
     [not found]   ` <20030925084932.GA22441@polyware.nl>
     [not found]     ` <1064484678.2227.465.camel@shrek.bitfreak.net>
     [not found]       ` <20030925102635.GA25634@polyware.nl>
2003-09-25 15:59         ` zr36120 2.6.x port (was: Re: [Mjpeg-users] DC30+ can't capture size greater than 224x168) Ronald Bultje
2003-09-25 16:10           ` Christoph Hellwig [this message]
2003-09-25 19:21             ` Ronald Bultje
2003-09-25 16:43           ` Gerd Knorr

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=20030925171010.A17271@infradead.org \
    --to=hch@infradead.org \
    --cc=kraxel@bytesex.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=middelink@polyware.nl \
    --cc=rbultje@ronald.bitfreak.net \
    /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