LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] genhd must_check warning fix
@ 2008-03-12 0:13 Roland McGrath
2008-03-12 3:25 ` Jeff Garzik
0 siblings, 1 reply; 6+ messages in thread
From: Roland McGrath @ 2008-03-12 0:13 UTC (permalink / raw)
To: Andrew Morton, Linus Torvalds; +Cc: linux-kernel
Fixes:
block/genhd.c:361: warning: ignoring return value of ‘class_register’, declared with attribute warn_unused_result
Signed-off-by: Roland McGrath <roland@redhat.com>
---
block/genhd.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/block/genhd.c b/block/genhd.c
index c44527d..00da521 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -360,7 +360,9 @@ static struct kobject *base_probe(dev_t devt, int *part, void *data)
static int __init genhd_device_init(void)
{
- class_register(&block_class);
+ int error = class_register(&block_class);
+ if (unlikely(error))
+ return error;
bdev_map = kobj_map_init(base_probe, &block_class_lock);
blk_dev_init();
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] genhd must_check warning fix
2008-03-12 0:13 [PATCH] genhd must_check warning fix Roland McGrath
@ 2008-03-12 3:25 ` Jeff Garzik
2008-03-12 3:40 ` Nick Piggin
0 siblings, 1 reply; 6+ messages in thread
From: Jeff Garzik @ 2008-03-12 3:25 UTC (permalink / raw)
To: Roland McGrath; +Cc: Andrew Morton, Linus Torvalds, linux-kernel
Roland McGrath wrote:
> Fixes:
>
> block/genhd.c:361: warning: ignoring return value of ‘class_register’, declared with attribute warn_unused_result
>
> Signed-off-by: Roland McGrath <roland@redhat.com>
> ---
> block/genhd.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/block/genhd.c b/block/genhd.c
> index c44527d..00da521 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -360,7 +360,9 @@ static struct kobject *base_probe(dev_t devt, int *part, void *data)
>
> static int __init genhd_device_init(void)
> {
> - class_register(&block_class);
> + int error = class_register(&block_class);
> + if (unlikely(error))
> + return error;
> bdev_map = kobj_map_init(base_probe, &block_class_lock);
> blk_dev_init();
ACK
I was silly and simply tuned out this warning, assuming [wrongly] that
it was difficult to fix like the fs/partitions.c warning.
Shows how "helpful" those warnings are...
Jeff
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] genhd must_check warning fix
2008-03-12 3:25 ` Jeff Garzik
@ 2008-03-12 3:40 ` Nick Piggin
2008-03-12 3:53 ` Jeff Garzik
0 siblings, 1 reply; 6+ messages in thread
From: Nick Piggin @ 2008-03-12 3:40 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Roland McGrath, Andrew Morton, Linus Torvalds, linux-kernel
On Wednesday 12 March 2008 14:25, Jeff Garzik wrote:
> Roland McGrath wrote:
> > Fixes:
> >
> > block/genhd.c:361: warning: ignoring return value of ‘class_register’,
> > declared with attribute warn_unused_result
> >
> > Signed-off-by: Roland McGrath <roland@redhat.com>
> > ---
> > block/genhd.c | 4 +++-
> > 1 files changed, 3 insertions(+), 1 deletions(-)
> >
> > diff --git a/block/genhd.c b/block/genhd.c
> > index c44527d..00da521 100644
> > --- a/block/genhd.c
> > +++ b/block/genhd.c
> > @@ -360,7 +360,9 @@ static struct kobject *base_probe(dev_t devt, int
> > *part, void *data)
> >
> > static int __init genhd_device_init(void)
> > {
> > - class_register(&block_class);
> > + int error = class_register(&block_class);
> > + if (unlikely(error))
> > + return error;
> > bdev_map = kobj_map_init(base_probe, &block_class_lock);
> > blk_dev_init();
>
> ACK
>
> I was silly and simply tuned out this warning, assuming [wrongly] that
> it was difficult to fix like the fs/partitions.c warning.
>
> Shows how "helpful" those warnings are...
I don't see why? If the warning wasn't there, then Roland probably
wouldn't have noticed. So to me it shows that the warning actually
is helpful (without "") in this case.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] genhd must_check warning fix
2008-03-12 3:40 ` Nick Piggin
@ 2008-03-12 3:53 ` Jeff Garzik
2008-03-12 4:07 ` Nick Piggin
0 siblings, 1 reply; 6+ messages in thread
From: Jeff Garzik @ 2008-03-12 3:53 UTC (permalink / raw)
To: Nick Piggin; +Cc: Roland McGrath, Andrew Morton, Linus Torvalds, linux-kernel
Nick Piggin wrote:
> On Wednesday 12 March 2008 14:25, Jeff Garzik wrote:
>> Roland McGrath wrote:
>>> Fixes:
>>>
>>> block/genhd.c:361: warning: ignoring return value of ‘class_register’,
>>> declared with attribute warn_unused_result
>>>
>>> Signed-off-by: Roland McGrath <roland@redhat.com>
>>> ---
>>> block/genhd.c | 4 +++-
>>> 1 files changed, 3 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/block/genhd.c b/block/genhd.c
>>> index c44527d..00da521 100644
>>> --- a/block/genhd.c
>>> +++ b/block/genhd.c
>>> @@ -360,7 +360,9 @@ static struct kobject *base_probe(dev_t devt, int
>>> *part, void *data)
>>>
>>> static int __init genhd_device_init(void)
>>> {
>>> - class_register(&block_class);
>>> + int error = class_register(&block_class);
>>> + if (unlikely(error))
>>> + return error;
>>> bdev_map = kobj_map_init(base_probe, &block_class_lock);
>>> blk_dev_init();
>> ACK
>>
>> I was silly and simply tuned out this warning, assuming [wrongly] that
>> it was difficult to fix like the fs/partitions.c warning.
>>
>> Shows how "helpful" those warnings are...
>
> I don't see why? If the warning wasn't there, then Roland probably
> wouldn't have noticed. So to me it shows that the warning actually
> is helpful (without "") in this case.
The point was more that the warnings are so often silly that it teaches
the human to tune out the warnings -- even when they turn out to reveal
real problems, as in this case.
I've been working quietly, the past several kernels, trying to kill most
compiler warnings, so I've been paying close attention to this sort of
stuff in general.
Jeff
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] genhd must_check warning fix
2008-03-12 3:53 ` Jeff Garzik
@ 2008-03-12 4:07 ` Nick Piggin
2008-03-12 15:05 ` Linus Torvalds
0 siblings, 1 reply; 6+ messages in thread
From: Nick Piggin @ 2008-03-12 4:07 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Roland McGrath, Andrew Morton, Linus Torvalds, linux-kernel
On Wednesday 12 March 2008 14:53, Jeff Garzik wrote:
> Nick Piggin wrote:
> > On Wednesday 12 March 2008 14:25, Jeff Garzik wrote:
> >> Roland McGrath wrote:
> >>> Fixes:
> >>>
> >>> block/genhd.c:361: warning: ignoring return value of ‘class_register’,
> >>> declared with attribute warn_unused_result
> >>>
> >>> Signed-off-by: Roland McGrath <roland@redhat.com>
> >>> ---
> >>> block/genhd.c | 4 +++-
> >>> 1 files changed, 3 insertions(+), 1 deletions(-)
> >>>
> >>> diff --git a/block/genhd.c b/block/genhd.c
> >>> index c44527d..00da521 100644
> >>> --- a/block/genhd.c
> >>> +++ b/block/genhd.c
> >>> @@ -360,7 +360,9 @@ static struct kobject *base_probe(dev_t devt, int
> >>> *part, void *data)
> >>>
> >>> static int __init genhd_device_init(void)
> >>> {
> >>> - class_register(&block_class);
> >>> + int error = class_register(&block_class);
> >>> + if (unlikely(error))
> >>> + return error;
> >>> bdev_map = kobj_map_init(base_probe, &block_class_lock);
> >>> blk_dev_init();
> >>
> >> ACK
> >>
> >> I was silly and simply tuned out this warning, assuming [wrongly] that
> >> it was difficult to fix like the fs/partitions.c warning.
> >>
> >> Shows how "helpful" those warnings are...
> >
> > I don't see why? If the warning wasn't there, then Roland probably
> > wouldn't have noticed. So to me it shows that the warning actually
> > is helpful (without "") in this case.
>
> The point was more that the warnings are so often silly that it teaches
> the human to tune out the warnings -- even when they turn out to reveal
> real problems, as in this case.
But the must_check warning? fs/partitions/check.c warning seems like it
is still a real error, whether or not it is hard to fix.
> I've been working quietly, the past several kernels, trying to kill most
> compiler warnings, so I've been paying close attention to this sort of
> stuff in general.
If you tune out the must_check warnings, then how is that better than
not having them at all? In either case, you'd have missed this genhd
bug(let).
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] genhd must_check warning fix
2008-03-12 4:07 ` Nick Piggin
@ 2008-03-12 15:05 ` Linus Torvalds
0 siblings, 0 replies; 6+ messages in thread
From: Linus Torvalds @ 2008-03-12 15:05 UTC (permalink / raw)
To: Nick Piggin; +Cc: Jeff Garzik, Roland McGrath, Andrew Morton, linux-kernel
On Wed, 12 Mar 2008, Nick Piggin wrote:
>
> If you tune out the must_check warnings, then how is that better than
> not having them at all? In either case, you'd have missed this genhd
> bug(let).
Quite frankly, there have historically been too many people who just added
"must_check" to their function prototypes because they thought they were
oh-so-important. Which means that at least _I_ tend to just ignore them
(and have asked people to remove some when they get too annoying).
So I'm not at all surprised that people tune them out. They have become
debased by being overused.
Linus
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-03-12 15:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-12 0:13 [PATCH] genhd must_check warning fix Roland McGrath
2008-03-12 3:25 ` Jeff Garzik
2008-03-12 3:40 ` Nick Piggin
2008-03-12 3:53 ` Jeff Garzik
2008-03-12 4:07 ` Nick Piggin
2008-03-12 15:05 ` Linus Torvalds
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).