From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E15CCC433E6 for ; Wed, 24 Feb 2021 22:44:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9A5D764F03 for ; Wed, 24 Feb 2021 22:44:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232486AbhBXWou (ORCPT ); Wed, 24 Feb 2021 17:44:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231974AbhBXWom (ORCPT ); Wed, 24 Feb 2021 17:44:42 -0500 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9541C061574; Wed, 24 Feb 2021 14:44:01 -0800 (PST) Received: by mail-ed1-x52c.google.com with SMTP id p1so33810edy.2; Wed, 24 Feb 2021 14:44:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=99V2B0lnlTGfCOt0X39MWt84YcT3N4F3t+5LYtHZ6Iw=; b=p73RPwZFjFXxYHKyRyrcKs0GB/hGBGHBVL0/qLOu/GuPnm3gWqcZ1cCQLMgVfRcENg XFity6oJZgxZ8KpDzdFLmqTRb+gfb4oC4Oz9s9pL+d4xquct3IeRkZYdTug5K67ryvfP DQ5TcvAbS4Hz/yPoplIrhdziBemOkBqZhEcXggk6A9Ic2AEp6fUMvakb8c0tMC8C+IVW AkfPUP2895v0F6cg/0JqwTMPsqbVGPczwN/137oDbKP/kurnE5XDVAIj61dmb6xO5Ura 3Ht3xecyi1dqmrmzhuYw6MS5EfWklYJrevHC/bFJbMZ0rgg6kqPkza2YBT5D5YWspaBh YqLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=99V2B0lnlTGfCOt0X39MWt84YcT3N4F3t+5LYtHZ6Iw=; b=e6PCG3jFvBeKpUbtw27ZEPIEz/caOI2uR6AwDHNNXSzPOsw0N3VtHsoCAmnrM66vU5 KbFtSu6RQman4AS1fUCCVxR/2Zrj0cMVTQtegMQ/zq/RkcEZ6vJ00BWiCxqoLL/gpyJd WwIRMwWgMpq6znPnMYrvPpFJlgtnOTsyDKRpTL8u3f33aJth3K3GhsX5VPsqWArGsh2R SjBOwRY2ibQT/yQ+BUr1fX4bybcpfSlQSpvtliXDaZPSgoFaJCBdpFR/PssrButvBTat uVSL/+7xa4J2iUVLxn+6zHrsKjK261EYJm4gIU+KbISywqDro4C5Mx+sgPfoZOHJ5iq+ OYGQ== X-Gm-Message-State: AOAM531H2h2/4js0hFSdF1PGcN9EdmOF0TMX5AEPwwJd6FD3ltnqsAS0 khtbyguhULkqeaFx0Hk6CAgMebYxaWk= X-Google-Smtp-Source: ABdhPJwJU5EMZypPEqCk9rg3mlZaM0FS5VotXftAQn6Pmqmf9MgXhD16wMOjK4wB9r2MazBdyg7z2g== X-Received: by 2002:a50:ed11:: with SMTP id j17mr70812eds.324.1614206640326; Wed, 24 Feb 2021 14:44:00 -0800 (PST) Received: from skbuf ([188.25.217.13]) by smtp.gmail.com with ESMTPSA id qx17sm2038811ejb.85.2021.02.24.14.43.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 14:43:59 -0800 (PST) Date: Thu, 25 Feb 2021 00:43:58 +0200 From: Vladimir Oltean To: Geert Uytterhoeven Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S . Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: dsa: sja1105: Remove unneeded cast in sja1105_crc32() Message-ID: <20210224224358.pysql5pu23zt7mtb@skbuf> References: <20210223112003.2223332-1-geert+renesas@glider.be> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210223112003.2223332-1-geert+renesas@glider.be> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- Reviewed-by: Vladimir Oltean 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.