[lkml]   [2009]   [Jul]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH 01/06] Fix compilation warning for sound/soc/codecs/wm8400.c
    On Thu, Jul 16, 2009 at 06:40:01PM +0530, Subrata Modak wrote:

    > How about the following brutal shutdown ?

    No, this is the patch you originally submitted. You are missing the
    point here - your patches are all just papering over the warning and
    won't help at all if there is an actual problem.

    > 'factors' will get initialized here, as, 'freq_out' will probably never have
    > a '0' value. So, 'fll_factors()' will actually overwrite values in 'factors'
    > even after the initial brutal assignment:
    > "struct fll_factors factors = {}"

    This is pretty much the point of the warning when it's valid - it's
    trying to catch situations where there is a code path where the variable
    is used without being initialised. If you just blindly initialise the
    variable as you are doing then the warning goes away but any problematic
    code remains so the situation is worse.

    In this case I suspect that whatever compiler you are using (none of
    those I've tried with seem to be doing this) isn't able to figure out
    that if we skip initialising the variable then we use exactly the same
    condition to return from the function before we try to use the variable.
    For something like this the warning can normally be worked around by
    changing the control flow so that the compiler is able to figure out
    that things are safe.

     \ /
      Last update: 2009-07-16 15:25    [W:0.020 / U:5.040 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site