Bug 69071 - media/davinci_vpfe/dm365_ipipe_hw.c:270: possible bad if test ?
Summary: media/davinci_vpfe/dm365_ipipe_hw.c:270: possible bad if test ?
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: Staging (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: drivers_staging@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-20 14:57 UTC by David Binderman
Modified: 2014-07-05 01:33 UTC (History)
1 user (show)

See Also:
Kernel Version: 3.13
Tree: Mainline
Regression: No


Attachments

Description David Binderman 2014-01-20 14:57:57 UTC
Static analyser cppcheck says

[linux-3.13/drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c:270]: (style) A pointer can not be negative so it is either pointless or an error to check if it is.

Source code is

    ipipe_mode = get_ipipe_mode(ipipe);
    if (ipipe < 0) {
        pr_err("Failed to get ipipe mode");
        return -EINVAL;
    }

I suspect 

    ipipe_mode = get_ipipe_mode(ipipe);
    if (ipipe_mode < 0) {
        pr_err("Failed to get ipipe mode");
        return -EINVAL;
    }

might be better code.
Comment 1 Andrey Utkin 2014-07-05 01:33:55 UTC
Patch posted, see https://patchwork.kernel.org/patch/4486101/
Please look if that is clean for checker now.

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