Bug 69071

Summary: media/davinci_vpfe/dm365_ipipe_hw.c:270: possible bad if test ?
Product: Drivers Reporter: David Binderman (dcb314)
Component: StagingAssignee: drivers_staging (drivers_staging)
Status: NEW ---    
Severity: normal CC: andrey_utkin
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.13 Subsystem:
Regression: No Bisected commit-id:

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.