mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alessandro Zummo <alessandro.zummo@towertech.it>
To: Rolf Eike Beer <eike-kernel@sf-tec.de>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: [RTC] Remove superfluous call to call to cdev_del()
Date: Thu, 21 Sep 2006 09:56:19 +0200	[thread overview]
Message-ID: <20060921095619.0b2f1774@inspiron> (raw)
In-Reply-To: <200609210946.06924.eike-kernel@sf-tec.de>

On Thu, 21 Sep 2006 09:46:06 +0200
Rolf Eike Beer <eike-kernel@sf-tec.de> wrote:

> If cdev_add() fails there is no good reason to call cdev_del().
> 
> Signed-off-by: Rolf Eike Beer <eike-kernel@sf-tec.de>
>
>  	rtc->char_dev.owner = rtc->owner;
>  
>  	if (cdev_add(&rtc->char_dev, MKDEV(MAJOR(rtc_devt), rtc->id), 1)) {
> -		cdev_del(&rtc->char_dev);
>  		dev_err(class_dev->dev,
>  			"failed to add char device %d:%d\n",
>  			MAJOR(rtc_devt), rtc->id);

 I'm not sure.. this is drivers/char/raw.c:


 cdev_init(&raw_cdev, &raw_fops);
        if (cdev_add(&raw_cdev, dev, MAX_RAW_MINORS)) {
                kobject_put(&raw_cdev.kobj);
                unregister_chrdev_region(dev, MAX_RAW_MINORS);
                goto error;
        }

 in case of failure, it does a kobject_put.
 tha same call is done by cdev_del.

 other drivers have implemented different error paths.
 which one is correct?

-- 

 Best regards,

 Alessandro Zummo,
  Tower Technologies - Turin, Italy

  http://www.towertech.it


  reply	other threads:[~2006-09-21  7:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-21  7:46 Rolf Eike Beer
2006-09-21  7:56 ` Alessandro Zummo [this message]
2006-09-21  8:30   ` Rolf Eike Beer
2006-09-21 14:44     ` Dmitry Torokhov

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=20060921095619.0b2f1774@inspiron \
    --to=alessandro.zummo@towertech.it \
    --cc=akpm@osdl.org \
    --cc=eike-kernel@sf-tec.de \
    --cc=linux-kernel@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

Powered by JetHome