public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH][5/5][resend] floppy.c: Fix device_create_file() warning
@ 2007-03-20  8:32 Mikael Pettersson
  2007-03-20  9:24 ` Jesper Juhl
  2007-03-20 11:29 ` Andreas Kleen
  0 siblings, 2 replies; 10+ messages in thread
From: Mikael Pettersson @ 2007-03-20  8:32 UTC (permalink / raw)
  To: ak, jesper.juhl; +Cc: akpm, alan, bzolnier, linux-kernel, trent.waddington

On Mon, 19 Mar 2007 18:42:22 +0100, Jesper Juhl wrote:
> --- 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;

The floppy driver's sysfs file just provides some auxiliary
information to user-space, none of which matters for most of
its users. It is IMO totally inappropriate to fail floppy
driver init in this case.

/Mikael

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: [PATCH][5/5][resend] floppy.c: Fix device_create_file() warning
@ 2007-03-20 11:56 Mikael Pettersson
  0 siblings, 0 replies; 10+ messages in thread
From: Mikael Pettersson @ 2007-03-20 11:56 UTC (permalink / raw)
  To: ak, mikpe
  Cc: akpm, alan, bzolnier, jesper.juhl, linux-kernel, trent.waddington

On Tue, 20 Mar 2007 12:29:49 +0100 (CET), Andreas Kleen <ak@suse.de> wrote:
> > The floppy driver's sysfs file just provides some auxiliary
> > information to user-space, none of which matters for most of
> > its users. It is IMO totally inappropriate to fail floppy
> > driver init in this case.
> 
> I thought it was for udev to create the device nodes? But
> I might be wrong on that.

It's a file called "cmos" containing the ASCII
representation of UDP->cmos, which appears to be some
kind of "type" indicator. See floppy_cmos_show().

The file is only readable, not even root can write to it.

On one of my machines it contains the value "4", but the
device nodes udev created are still just /dev/fd0 and
/dev/floppy -> /dev/fd0, so I don't think it affects udev.

The "cmos" file seems to be a relatively new addition,
as another machine here running an RHEL4 2.6.9 kernel
doesn't have it.

Unless someone can prove that it's useful I think it
should be removed.

/Mikael

^ permalink raw reply	[flat|nested] 10+ messages in thread
* [PATCH][5/5][resend] floppy.c: Fix device_create_file() warning
@ 2007-03-19 15:11 Jesper Juhl
  2007-03-19 15:13 ` Andi Kleen
  0 siblings, 1 reply; 10+ messages in thread
From: Jesper Juhl @ 2007-03-19 15:11 UTC (permalink / raw)
  To: Andrew Morton
  Cc: LKML, Andi Kleen, Trent Waddington, Bartlomiej Zolnierkiewicz,
	Alan Cox, Jesper Juhl


    This fixes the warning
      warning: ignoring return value of `device_create_file', declared with attribute warn_unused_result in function `floppy_init'.
    It does this by checking the return value and printing a warning message in case of no success.
    
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Acked-by: Alan Cox <alan@redhat.com>
Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.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);
+
 		/* to be cleaned up... */
 		disks[drive]->private_data = (void *)(long)drive;
 		disks[drive]->queue = floppy_queue;

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-03-21  7:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-20  8:32 [PATCH][5/5][resend] floppy.c: Fix device_create_file() warning Mikael Pettersson
2007-03-20  9:24 ` Jesper Juhl
2007-03-21  7:11   ` Dmitriy Monakhov
2007-03-20 11:29 ` Andreas Kleen
  -- strict thread matches above, loose matches on Subject: below --
2007-03-20 11:56 Mikael Pettersson
2007-03-19 15:11 Jesper Juhl
2007-03-19 15:13 ` Andi Kleen
2007-03-19 15:16   ` Jesper Juhl
2007-03-19 15:20     ` Andi Kleen
2007-03-19 17:42       ` Jesper Juhl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox