lkml.org 
[lkml]   [2021]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] net: dsa: sja1105: Remove unneeded cast in sja1105_crc32()
    On Tue, Feb 23, 2021 at 12:20:03PM +0100, Geert Uytterhoeven wrote:
    > sja1105_unpack() takes a "const void *buf" as its first parameter, so
    > there is no need to cast away the "const" of the "buf" variable before
    > calling it.
    >
    > Drop the cast, as it prevents the compiler performing some checks.
    >
    > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
    > ---

    Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

    By the way, your email went straight to my spam box, I just found the
    patch by mistake on patchwork.

    Why is this message in spam?
    It is in violation of Google's recommended email sender guidelines.

    > Compile-tested only.
    >
    > BTW, sja1105_packing() and packing() are really bad APIs, as the input
    > pointer parameters cannot be const due to the direction depending on
    > "op". This means the compiler cannot do const checks. Worse, callers
    > are required to cast away constness to prevent the compiler from
    > issueing warnings. Please don't do this!
    > ---

    What const checks can the compiler not do?
    Also, if you know of an existing kernel API which can replace packing(),
    I'm all ears.

    \
     
     \ /
      Last update: 2021-02-24 23:46    [W:2.898 / U:0.040 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site