Bug 80361 - metag/kernel/cachepart.c:102: bad way to test for failure ?
Summary: metag/kernel/cachepart.c:102: bad way to test for failure ?
Status: NEW
Alias: None
Product: Platform Specific/Hardware
Classification: Unclassified
Component: Other (show other bugs)
Hardware: Other Linux
: P1 normal
Assignee: platform_other
Depends on:
Reported: 2014-07-16 17:05 UTC by David Binderman
Modified: 2014-07-17 13:31 UTC (History)
1 user (show)

See Also:
Kernel Version: 3.16-rc5
Tree: Mainline
Regression: No


Description David Binderman 2014-07-16 17:05:32 UTC
[linux-3.16-rc5/arch/metag/kernel/cachepart.c:102]: (style) Checking if unsigned variable 'thread_cache_size' is less than zero.

Source code is

        if (thread_cache_size < 0)
            pr_emerg("Can't read %s cache size\n",
                 cache_type ? "DCACHE" : "ICACHE");


    unsigned int thread_cache_size;

Function get_thread_cache_size returns an error code
as (unsigned int) -1. 

Maybe it would be better to test for that ?
Comment 1 Andrey Utkin 2014-07-17 13:31:18 UTC
Thanks, patch submitted: https://patchwork.kernel.org/patch/4575011/

Note You need to log in before you can comment on or make changes to this bug.