mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Abdel Benamrouche <draconux@gmail.com>
Cc: aeb@cwi.nl, linux-kernel@vger.kernel.org, trivial@kernel.org,
	draconux@gmail.com
Subject: Re: [PATCH] /fs/partition/check.c: fix return value warning
Date: Mon, 12 May 2008 15:27:43 -0700	[thread overview]
Message-ID: <20080512152743.3c6b8adc.akpm@linux-foundation.org> (raw)
In-Reply-To: <1210419653-19234-1-git-send-email-draconux@gmail.com>

On Sat, 10 May 2008 13:40:53 +0200
Abdel Benamrouche <draconux@gmail.com> wrote:

> fs/partitions/check.c:381: warning: ignoring return value of ___device_add___,
>  declared with attribute warn_unused_result
> 
> Signed-off-by: Abdel Benamrouche <draconux@gmail.com>
> ---
> :100644 100644 6149e4b... 7a87fad... M	fs/partitions/check.c
>  fs/partitions/check.c |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/partitions/check.c b/fs/partitions/check.c
> index 6149e4b..7a87fad 100644
> --- a/fs/partitions/check.c
> +++ b/fs/partitions/check.c
> @@ -378,7 +378,13 @@ void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len,
>  
>  	/* delay uevent until 'holders' subdir is created */
>  	p->dev.uevent_suppress = 1;
> -	device_add(&p->dev);
> +	if (device_add(&p->dev)) {
> +		put_device(&p->dev);
> +		free_part_stats(p);
> +		kfree(p);
> +		return;
> +	}
> +
>  	partition_sysfs_add_subdir(p);
>  	p->dev.uevent_suppress = 0;
>  	if (flags & ADDPART_FLAG_WHOLEDISK)

We should go further than this.  add_partition() just drops the error
on the floor.  It should be propagated back to callers, and callers
should be modified to handle it appropriately.

Presumably we should also handle a device_create_file() failure as well
- that is presently being silently ignored.


  reply	other threads:[~2008-05-12 22:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-10 11:40 Abdel Benamrouche
2008-05-12 22:27 ` Andrew Morton [this message]
2008-05-19 22:53   ` Jesper Juhl

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=20080512152743.3c6b8adc.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=aeb@cwi.nl \
    --cc=draconux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trivial@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

all inboxes | Powered by JetHome®