Re: [PATCH] rio: warn_unused_result warnings fix

From: Li Yang
Date: Tue Apr 28 2009 - 07:08:31 EST


On Tue, Apr 28, 2009 at 6:51 PM, Michael Ellerman
<michael@xxxxxxxxxxxxxx> wrote:
> On Tue, 2009-04-28 at 18:15 +0800, Li Yang wrote:
>> warning: ignoring return value of 'device_add', declared with attribute warn_unused_result
>> warning: ignoring return value of 'sysfs_create_bin_file', declared with attribute warn_unused_result
>>
>> Signed-off-by: Li Yang <leoli@xxxxxxxxxxxxx>
>> ---
>> Âdrivers/rapidio/rio-scan.c Â| Â Â5 ++++-
>> Âdrivers/rapidio/rio-sysfs.c | Â Â6 ++++--
>> Â2 files changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c
>> index 74d0bfa..9309e24 100644
>> --- a/drivers/rapidio/rio-scan.c
>> +++ b/drivers/rapidio/rio-scan.c
>> @@ -265,7 +265,10 @@ static void rio_route_set_ops(struct rio_dev *rdev)
>> Â */
>> Âstatic void __devinit rio_add_device(struct rio_dev *rdev)
>> Â{
>> - Â Â device_add(&rdev->dev);
>> + Â Â int err;
>> +
>> + Â Â err = device_add(&rdev->dev);
>> + Â Â WARN_ON(err);
>>
>> Â Â Â spin_lock(&rio_global_list_lock);
>> Â Â Â list_add_tail(&rdev->global_list, &rio_devices);
>
> Is that really useful? Why not return the error to rio_setup_device()
> which can tell it's caller.

IMHO, when device_add() fails the system is quite broken. So the
value is very limited for it to fail cleanly, which need some effort
to implement. I can add it if you insist.

- Leo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/