public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: Monakhov Dmitriy <dmonakhov@openvz.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: floppy: handle device_create_file() failure while init
Date: Tue, 08 May 2007 19:10:56 -0400	[thread overview]
Message-ID: <46410380.2060906@garzik.org> (raw)
In-Reply-To: <200705081900.l48J0kiv005844@hera.kernel.org>

Linux Kernel Mailing List wrote:
> Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4ea1b0f4c4f656e0838a937c47be9544ed1c5118
> Commit:     4ea1b0f4c4f656e0838a937c47be9544ed1c5118
> Parent:     6de2d20235a2b8c751d39ec4b68347d66b19d815
> Author:     Dmitriy Monakhov <dmonakhov@sw.ru>
> AuthorDate: Tue May 8 00:25:58 2007 -0700
> Committer:  Linus Torvalds <torvalds@woody.linux-foundation.org>
> CommitDate: Tue May 8 11:15:02 2007 -0700
> 
>     floppy: handle device_create_file() failure while init
>     
>     This patch kills the "ignoring return value of 'device_create_file'"
>     warning message.
>     
>     Signed-off-by: Monakhov Dmitriy <dmonakhov@openvz.org>
>     Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
>     Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
> ---
>  drivers/block/floppy.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
> index 5231ed7..3587cb4 100644
> --- a/drivers/block/floppy.c
> +++ b/drivers/block/floppy.c
> @@ -4334,7 +4334,10 @@ 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_unreg_platform_dev;
> +
>  		/* to be cleaned up... */
>  		disks[drive]->private_data = (void *)(long)drive;
>  		disks[drive]->queue = floppy_queue;
> @@ -4345,6 +4348,8 @@ static int __init floppy_init(void)
>  
>  	return 0;
>  
> +out_unreg_platform_dev:
> +	platform_device_unregister(&floppy_device[drive]);
>  out_flush_work:
>  	flush_scheduled_work();
>  	if (usage_count)


This patch appears to leave things in a half-initialized state, upon error.

That's the big reason why I did not bother with this warning, it's not 
the low-hanging fruit it appears to be.

	Jeff



           reply	other threads:[~2007-05-08 23:11 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <200705081900.l48J0kiv005844@hera.kernel.org>]

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=46410380.2060906@garzik.org \
    --to=jeff@garzik.org \
    --cc=akpm@linux-foundation.org \
    --cc=dmonakhov@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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