Linux s390 Architecture development
 help / color / mirror / Atom feed
From: Sebastian Ott <sebott@linux.vnet.ibm.com>
To: linux-s390@vger.kernel.org
Subject: Re: [PATCH] cio: double put_device() in subchannel_register()
Date: Tue, 25 Aug 2009 08:48:47 +0000	[thread overview]
Message-ID: <alpine.LFD.2.00.0908251046060.3246@localhost.localdomain> (raw)
In-Reply-To: <4A92BA1C.4050909@gmail.com>

Hi,

On Mon, 24 Aug 2009, Roel Kluin wrote:

> If the device can't be registered, put_device(&cdev->dev) occured here
> and after out_err:.
> 

The additional put_device should not be removed.

To register a ccw device we use device_initialize, do some
asynchronous recognition and call io_subchannel_register() via a
workqueue.
So in io_subchannel_register the refcount should be 2 (1 for the
initialization and 1 for workqueue processing). If the device_add
fails at this point we drop both references, so that the devices'
release function gets called.

Regards,
Sebastian

> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
> index 3c57c1a..8c17757 100644
> --- a/drivers/s390/cio/device.c
> +++ b/drivers/s390/cio/device.c
> @@ -999,8 +999,6 @@ io_subchannel_register(struct work_struct *work)
>  		spin_lock_irqsave(sch->lock, flags);
>  		sch_set_cdev(sch, NULL);
>  		spin_unlock_irqrestore(sch->lock, flags);
> -		/* Release initial device reference. */
> -		put_device(&cdev->dev);
>  		goto out_err;
>  	}
>  out:
> --
> To unsubscribe from this list: send the line "unsubscribe linux-s390" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

           reply	other threads:[~2009-08-25  8:48 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <4A92BA1C.4050909@gmail.com>]

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=alpine.LFD.2.00.0908251046060.3246@localhost.localdomain \
    --to=sebott@linux.vnet.ibm.com \
    --cc=linux-s390@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox