[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <200703191842.24152.jesper.juhl@gmail.com>
Date: Mon, 19 Mar 2007 18:42:22 +0100
From: Jesper Juhl <jesper.juhl@...il.com>
To: Andi Kleen <ak@...e.de>
Cc: "Andrew Morton" <akpm@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>,
"Trent Waddington" <trent.waddington@...il.com>,
"Bartlomiej Zolnierkiewicz" <bzolnier@...il.com>,
"Alan Cox" <alan@...rguk.ukuu.org.uk>, jesper.juhl@...il.com
Subject: Re: [PATCH][5/5][resend] floppy.c: Fix device_create_file() warning
On Monday 19 March 2007 16:20:00 Andi Kleen wrote:
> On Monday 19 March 2007 16:16, Jesper Juhl wrote:
> > On 19/03/07, Andi Kleen <ak@...e.de> wrote:
> > > > -
> > > > device_create_file(&floppy_device[drive].dev,&dev_attr_cmos); +
> > > > err = device_create_file(&floppy_device[drive].dev,
> > > > &dev_attr_cmos); + if (err)
> > > > + printk(KERN_WARNING "Unable to create sysfs
> > > > attribute " + "file for floppy device:
> > > > %s\n", + floppy_device[drive].name);
> > >
> > > That change looks pretty useless. Either the error should be handled
> > > correctly by bailing out or the warn_unused_results should be dropped.
> >
> > At least letting the user know that something failed is better than
> > the current situation of just failing silently I'd say.
>
> I don't think so. That's just bloat.
>
Ok, how about one of the following then?
Personally I'd be ok with either one.
Either this :
Signed-off-by: Jesper Juhl <jesper.juhl@...il.com>
---
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 577c621..9d543f3 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -4302,7 +4302,12 @@ static int __init floppy_init(void)
if (err)
goto out_flush_work;
- device_create_file(&floppy_device[drive].dev,&dev_attr_cmos);
+ err = device_create_file(&floppy_device[drive].dev, &dev_attr_cmos);
+ if (err) {
+ printk(KERN_WARNING "Unable to create sysfs attribute "
+ "file for floppy device: %s\n",
+ floppy_device[drive].name);
+ goto out_flush_work;
+ }
+
/* to be cleaned up... */
disks[drive]->private_data = (void *)(long)drive;
disks[drive]->queue = floppy_queue;
or this :
Signed-off-by: Jesper Juhl <jesper.juhl@...il.com>
---
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 577c621..9d543f3 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -4302,7 +4302,12 @@ static int __init floppy_init(void)
if (err)
goto out_flush_work;
- device_create_file(&floppy_device[drive].dev,&dev_attr_cmos);
+ err = device_create_file(&floppy_device[drive].dev, &dev_attr_cmos);
+ if (err)
+ goto out_flush_work;
+
/* to be cleaned up... */
disks[drive]->private_data = (void *)(long)drive;
disks[drive]->queue = floppy_queue;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists