public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 2/5] cdrom: cleanup hardcoded error-code
Date: Sat, 22 Mar 2008 12:10:48 +0900	[thread overview]
Message-ID: <20080322031047.GB3665@APFDCB5C> (raw)
In-Reply-To: <20080322030948.GA3665@APFDCB5C>

This patch eliminates hardcoded return value of register_cdrom().

It also changes the return value to -EINVAL.
It is more appropriate than -2 (-ENOENT) because it is only
happen invalid usage of register_cdrom() by broken cdrom driver.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>
---
 drivers/cdrom/cdrom.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: 2.6-git/drivers/cdrom/cdrom.c
===================================================================
--- 2.6-git.orig/drivers/cdrom/cdrom.c
+++ 2.6-git/drivers/cdrom/cdrom.c
@@ -393,7 +393,7 @@ int register_cdrom(struct cdrom_device_i
 	cdinfo(CD_OPEN, "entering register_cdrom\n"); 
 
 	if (cdo->open == NULL || cdo->release == NULL)
-		return -2;
+		return -EINVAL;
 	if (!banner_printed) {
 		printk(KERN_INFO "Uniform CD-ROM driver " REVISION "\n");
 		banner_printed = 1;

  reply	other threads:[~2008-03-22  3:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-22  3:09 [PATCH 1/5] cdrom: remove ifdef CONFIG_SYSCTL Akinobu Mita
2008-03-22  3:10 ` Akinobu Mita [this message]
2008-03-22  3:12   ` [PATCH 3/5] cdrom: protect cdrom_device_info list by mutex Akinobu Mita
2008-03-22  3:12     ` [PATCH 4/5] cdrom: use list_head for cdrom_device_info list Akinobu Mita
2008-03-22  3:14       ` [PATCH 5/5] cdrom: make unregister_cdrom() return void Akinobu Mita
2008-03-22 12:57         ` Jens Axboe
2008-03-22 15:45         ` Borislav Petkov
2008-03-22 16:43         ` Adrian McMenamin
2008-03-22 12:55       ` [PATCH 4/5] cdrom: use list_head for cdrom_device_info list Jens Axboe
2008-03-22 12:56         ` Jens Axboe
2008-03-22 15:10         ` Akinobu Mita
2008-03-22 17:57           ` Christoph Hellwig
2008-03-25 19:04             ` Jens Axboe

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=20080322031047.GB3665@APFDCB5C \
    --to=akinobu.mita@gmail.com \
    --cc=axboe@kernel.dk \
    --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