lkml.org 
[lkml]   [2010]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] radio-si470x-common: -EINVAL overwritten in si470x_vidioc_s_tuner()
    Tobias Lorenz wrote:
    > Hello Roel,
    >
    > no, the default value of retval makes no difference to the function.
    >
    > Retval is set by si470x_disconnect_check and si470x_set_register.
    > After each call, retval is checked.
    > There is no need to reset it passed.
    >
    > The only reason, there is a default value is my static code checker, saying variables should have default values.
    > Setting it to -EINVAL seems more reasonable to me than setting it 0.
    > In fact the patch would bring up the warning on setting default values again.

    Well, your static code checker is then broken ;)

    >> struct si470x_device *radio = video_drvdata(file);
    >> - int retval = -EINVAL;
    >> + int retval;
    >>
    >> /* safety checks */
    >> retval = si470x_disconnect_check(radio);

    You may just do then:

    int retval = si470x_disconnect_check(radio);

    >> if (retval)
    >> goto done;
    >> + retval = -EINVAL;
    >>
    >> if (tuner->index != 0)
    >> goto done;
    >>
    > --
    > To unsubscribe from this list: send the line "unsubscribe linux-media" in
    > the body of a message to majordomo@vger.kernel.org
    > More majordomo info at http://vger.kernel.org/majordomo-info.html


    --

    Cheers,
    Mauro


    \
     
     \ /
      Last update: 2010-02-04 02:37    [W:0.021 / U:1.600 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site