Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp2394389rdg; Mon, 14 Aug 2023 00:32:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEPhYSIjv6BHVBCL6Mdw1fsM5amRRBkiEn6BMW5Hw1Dt0z17pqlOm02dprBUZ/o/Wr79Oeg X-Received: by 2002:a17:902:e844:b0:1b6:4bbd:c3a7 with SMTP id t4-20020a170902e84400b001b64bbdc3a7mr7982513plg.66.1691998348753; Mon, 14 Aug 2023 00:32:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691998348; cv=none; d=google.com; s=arc-20160816; b=MREOOuybcMT9SPXUEVQ/t0qba7Lhv2TQoGmAtT6vRb9J9G5ydb+oISRQKjpt9H0eRe qCmxifp/zwH02BOsKrj7wmsU12oZYj/ZEco65X++eR8yOCEMik6BCn+d97Y46uCYNMSW 7nYAXGtDwQpmGIrwSYD8pcqJpXIg9Mw/jG/8AzKffGMDv7y1Ac9m2qyK7Oq9Uc0Z5Yg7 kkF1092s99Kpm917L9R3bHuDYweHRye1U840GQSu7g7XwkjVpyNOBYf1HAZc/VaZHjWz 4VppWTlEOek2kpvkHqLmFVT/YRxeNuxJyOKy8GiuFUqYSjovYz3GrjLA05kAn0V7TSxY zfZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=fC9uTjaIAJ5FjIaqRIZtFBZkLO2XpgWA4xpYOOTE2qk=; fh=GE5dcm0mwAX+My4mnC1eF7ZmnUmCkGLiI941aqYhB5Y=; b=z/aMXtcv1E66XQ/Xbp/P2UcvPvqudpKyYoPDZwlJK19rA4FhfaSxqsbtW+1h3l9w1t SXliJVNsYRst0T5i44yBJqM2+iuh7F9kpNTotKfb/sh4uJ5eQUQNJqjWEEPswP5qWMeK sW5lzJk0QsLhCbmOiboOg8ZvKRWLun3JcPc4Fmyx8tR8qFrArB3XV+CYa4MeFTHlhImI 5istTfXjZwmG7TYRtcE8KvQEXl+L3kZJ/O5OfG1CIYuBr5C/Q/K0/UCjsdwMpolyHiRr Q7YB+utOPeWHt0xBBOCp/JCK5kukrDeDqhBZyYWGHV8jMLhS24xzYxx9knf80IdKZlwQ 3T1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cMkdSpxC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q8-20020a170902a3c800b001b8419bd0f5si7772497plb.254.2023.08.14.00.32.15; Mon, 14 Aug 2023 00:32:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cMkdSpxC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231661AbjHNG7H (ORCPT + 99 others); Mon, 14 Aug 2023 02:59:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233882AbjHNG6j (ORCPT ); Mon, 14 Aug 2023 02:58:39 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 627F2E63 for ; Sun, 13 Aug 2023 23:58:38 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-523ba00a581so4400259a12.2 for ; Sun, 13 Aug 2023 23:58:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691996317; x=1692601117; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=fC9uTjaIAJ5FjIaqRIZtFBZkLO2XpgWA4xpYOOTE2qk=; b=cMkdSpxCMvVPajP4PIy88jdv8ncvtVYL4/+ff0B+5ffKoxi3CaejoPppwJ+TrGEoru uUpKWR45EoM4qP251Dwx6DgfdWD4C03lFAB35yKKJgLUsxVxEZchtbzJSeCkAn2aD/Il TP8bis/HXGg/Qqak0Mk7cfmk1AWXXV5nuvtvDLtS9RC+IBYAPd9irNHbNmvXxqFwMVek DHsE/6ecoJwzHAFTxnHHclHayzo3gvlR8MuWHJPP5uduhGW0a9Ejdb6OrCs6PYKxm83A hL51IzmZDT/ekqvYLCEtej/JBOBtjkEbjtp1N7A1bAKBAWs26bHSaoTqG2nal+CNnPIE axvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691996317; x=1692601117; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fC9uTjaIAJ5FjIaqRIZtFBZkLO2XpgWA4xpYOOTE2qk=; b=DTNYLV5+zsxj7hn0M/doOuOauRqv/Mzyzhd98MACIie1xrihjNk77y96p8F75tFPXK 1gr45hFqO5+qbIgx+UqPIty9aptUMF6m3Cy6wO704PRSJDoY8OX9hf7MKiQFamq0Vpib yInZe+CN1BmITp8gt3xXBFHTFfhfB8DzTCe/rSP1KS5umeP70ZmmKCzf1dVSuJfATw5L +mrDGr59M6phd+Xx6YWz9Pb1Gw3qL3pqqCyjkF4LH0m9CDnoKJUV+xslLmGQQIJ4D22O roW4dbp9mr1AAfY1cV73sgiBtft9q7X2HOGUmpylEeQYQfS2SBEY3yXp+6sdWtfeA8iu ql4g== X-Gm-Message-State: AOJu0Yw+6VCibEOeYj5tq8Y5hXRXBMSjU3Xlkwtq+wHbH04d3p16GoaW BhB6bF8f54JbT2S6ZcZ0LqWyHg== X-Received: by 2002:a17:906:76d3:b0:99b:4fff:6bb with SMTP id q19-20020a17090676d300b0099b4fff06bbmr7626704ejn.4.1691996316874; Sun, 13 Aug 2023 23:58:36 -0700 (PDT) Received: from [192.168.1.20] ([178.197.214.188]) by smtp.gmail.com with ESMTPSA id z6-20020a17090655c600b0098748422178sm5322389ejp.56.2023.08.13.23.58.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 13 Aug 2023 23:58:36 -0700 (PDT) Message-ID: <66cbafc5-f490-511c-df9b-02c2e5e40811@linaro.org> Date: Mon, 14 Aug 2023 08:58:34 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: [PATCH] serial: mxs-uart: fix Wvoid-pointer-to-enum-cast warning Content-Language: en-US To: Greg Kroah-Hartman , Nathan Chancellor Cc: Jiri Slaby , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Andi Shyti References: <20230810085042.39252-1-krzysztof.kozlowski@linaro.org> <2023081004-lapped-handbag-0324@gregkh> From: Krzysztof Kozlowski In-Reply-To: <2023081004-lapped-handbag-0324@gregkh> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/08/2023 17:44, Greg Kroah-Hartman wrote: > On Thu, Aug 10, 2023 at 10:50:42AM +0200, Krzysztof Kozlowski wrote: >> `devtype` is enum, thus cast of pointer on 64-bit compile test with W=1 >> causes: >> >> mxs-auart.c:1598:15: error: cast to smaller integer type 'enum mxs_auart_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] >> >> Cc: Andi Shyti >> Signed-off-by: Krzysztof Kozlowski >> --- >> drivers/tty/serial/mxs-auart.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c >> index 8eeecf8ad359..a9b32722b049 100644 >> --- a/drivers/tty/serial/mxs-auart.c >> +++ b/drivers/tty/serial/mxs-auart.c >> @@ -1595,7 +1595,7 @@ static int mxs_auart_probe(struct platform_device *pdev) >> return -EINVAL; >> } >> >> - s->devtype = (enum mxs_auart_type)of_device_get_match_data(&pdev->dev); >> + s->devtype = (uintptr_t)of_device_get_match_data(&pdev->dev); > > This feels like a compiler issue as devtype is a enum mxs_auart_type > variable, so the cast shoudl be correct. While the cast is obviously safe here, the warning in general is reasonable - people were make too many mistakes by assuming pointers are integers... Just for the record (not saying that others doing is proof of correctness): https://lore.kernel.org/lkml/20230809-cbl-1903-v1-1-df9d66a3ba3e@google.com/T/ But maybe Nathan can share his thoughts whether we should just disable this warning for kernel? > > And if not, unitptr_t isn't a valid kernel type, so that's not a good It is in include/linux/types.h, so do you mean that it is not recommended for in-kernel usage? I can go with kernel_ulong_t - which is a kernel type - if the cast is agreed. > solution either. Worst case, it's how big a pointer is, which is not > going to be what an enum is if you have a sane compiler :( Best regards, Krzysztof