* [PATCH] /fs/partition/check.c: fix return value warning
@ 2008-05-10 11:40 Abdel Benamrouche
2008-05-12 22:27 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Abdel Benamrouche @ 2008-05-10 11:40 UTC (permalink / raw)
To: aeb; +Cc: linux-kernel, trivial, Abdel Benamrouche
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)
--
1.5.4.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] /fs/partition/check.c: fix return value warning
2008-05-10 11:40 [PATCH] /fs/partition/check.c: fix return value warning Abdel Benamrouche
@ 2008-05-12 22:27 ` Andrew Morton
2008-05-19 22:53 ` Jesper Juhl
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2008-05-12 22:27 UTC (permalink / raw)
To: Abdel Benamrouche; +Cc: aeb, linux-kernel, trivial, draconux
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] /fs/partition/check.c: fix return value warning
2008-05-12 22:27 ` Andrew Morton
@ 2008-05-19 22:53 ` Jesper Juhl
0 siblings, 0 replies; 3+ messages in thread
From: Jesper Juhl @ 2008-05-19 22:53 UTC (permalink / raw)
To: Abdel Benamrouche; +Cc: Andrew Morton, aeb, linux-kernel, trivial
Hi Abdel,
2008/5/13 Andrew Morton <akpm@linux-foundation.org>:
> 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.
>
Given these comments from Andrew, I'm not adding this patch to the Trivial tree.
Please address Andrews comments and re-submit - at which point I doubt
it'll be suitable for trivial, so please try to get it merged via
other maintainers.
--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-05-19 22:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-10 11:40 [PATCH] /fs/partition/check.c: fix return value warning Abdel Benamrouche
2008-05-12 22:27 ` Andrew Morton
2008-05-19 22:53 ` Jesper Juhl
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®