From patchwork Wed Aug 16 18:26:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Stitt X-Patchwork-Id: 13355566 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A9508C04FE0 for ; Wed, 16 Aug 2023 18:27:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID: Mime-Version:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=VwGxUofFf6l8tbSWQNG0y6iQ0L1ng4b668t7zI5VI9I=; b=gf6 pyVLetLza9QlWLxINhqfQ5whk1O6zRTSQ8xLA+jZorfwEEfsviCkVCUnmIG8aHnopLyZYz/Aebu3N p3msLK6j7YQg2e417WqMEGsqeVcmUA3RFZa6k/Da6sz8dLkXwfuIRCzR6r12YyF2ZZBetCPXxyAhe bBwVXsu9lLE4Q+yUkAgabYk6VVt5t3B4ktzItKCQgi72N3hy6XfwX9Qi7TiKB4l/wrdD/NswUo6UA upw77r4LFfRmeY4ECfce8zYxWWPHOAedGO4f8uP9ScPIQkZP0qQgjXWi4sU5Vymhx1CsdDD5dvgBC 6ReQpS05Y2TI5Nhkyb43NP3WsS00WLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWLER-004ncN-0H; Wed, 16 Aug 2023 18:26:59 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qWLEM-004nYw-2T for linux-arm-kernel@lists.infradead.org; Wed, 16 Aug 2023 18:26:56 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-589c772be14so2738367b3.0 for ; Wed, 16 Aug 2023 11:26:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1692210410; x=1692815210; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=S6as3BxJpUCbqcYsYLfwqrd6wpI3WguOJqonU+8LSLc=; b=z0c2F/G/8ZqCH25VdVy3+VNDQI8CZeomkJY3XdzlkKQh/JwPUa5Z1o9g74b4z1pxiH wRYVTVuqobGllrdShttdO/QSk1CkCvnHciCc+U6yeBKeMn+G8bMhR+kKrlyHuLI78mgH /xhC9LfsawjIy7OW5AbgBlur6CBQyM9oq+7T98ppgngF3OFCO5C4JO0Ati2/MimQ3z9U GEv8Fn8BOAvyhA3xgcd9vgY4844c7XHjvtPwYSJ8J0FHRfSxmOZ7IyzbNBghkWgIAK5u svFaihEPiZ2b4puUHNUBBfwTU3sl64Ck6rlz10eKKLgLmoxIB/j85T+jNUpMtdvqTLcr FPWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692210410; x=1692815210; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=S6as3BxJpUCbqcYsYLfwqrd6wpI3WguOJqonU+8LSLc=; b=XU72/HpqcXLsPD23zISYu+ba4wdzWPEr6SH3qPo01crcYb3c7hd1yPT0Ed+1glcQeJ X6hrkMrWjdLebZNXGDyXdWONeJVqXat7urEnENV8ebHAcS+ZXUmocw+9MAIymRTF+BvM X6V1fbkThDeHGl8qxrI7/WrFZlFazkwLoJa2zE8LTBMytJR1/XwW+qI0Id2xbITtocvp uprqKm/JKqe6yeZZJxmFLpqBIXjOvXD7ZV/oCqjhNiUfeWFG2HQOJuSCkpPhzaZ0sQ7b m87KOJljiyvgY9ZVmNPKdhvw12qpd3rNMpBAupsvki8f2wwG08del2L9lBQ0HcQRQSmz xhhA== X-Gm-Message-State: AOJu0YzMljavUM6dOZsAJ69623XjpyZLbIhgGFD5yPb2yFDl2xvetOhb VAP4E/5VdqRGfzuRKA1nSmBO1v4FoXLh23hLXQ== X-Google-Smtp-Source: AGHT+IGHa/5g87NdPEOq2wAtPaDB0w/dWc4EOap0B976E0FRPaTqbUwY726ZhRQ4H+6EEHfTB93fXA2tnit2luAlDA== X-Received: from jstitt-linux1.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:23b5]) (user=justinstitt job=sendgmr) by 2002:a81:4316:0:b0:58c:e8da:4d1a with SMTP id q22-20020a814316000000b0058ce8da4d1amr8918ywa.2.1692210410645; Wed, 16 Aug 2023 11:26:50 -0700 (PDT) Date: Wed, 16 Aug 2023 18:26:44 +0000 Mime-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAOMU3WQC/5WNSw6DMAwFr4K8riuSlo+64h4Vi5Q4YAkIilFUh Lh7Azfo7s0s3uwgFJgEXtkOgSIL+zmBvmXQDWbuCdkmBp3rR16rAqNnizZwpCA4rRYnswguwyZ p4GnNyiOh1lXuqHLWqRLS2xLI8fcqvdvEA8vqw3aFozrt/42oUOHHlK6rS1vQk5re+36ke+cna I/j+AGL1kKx3wAAAA== X-Developer-Key: i=justinstitt@google.com; a=ed25519; pk=tC3hNkJQTpNX/gLKxTNQKDmiQl6QjBNCGKJINqAdJsE= X-Developer-Signature: v=1; a=ed25519-sha256; t=1692210409; l=1749; i=justinstitt@google.com; s=20230717; h=from:subject:message-id; bh=8lAIhnmpRVK+py4l8xzNXorgfe03DykVYWVS/7qh4fw=; b=ktG2rQbNbxM+rTl/KVl5MI/PcP0u3a40de2Mqg6Bm+oJeBznguW1yO4lm/q5TFtmA7hRZT6nf DixvkgTw1w3BeuZDW/cwGzcjia8AwOtJnFMUleRe1Ten7DKqdvdMwwp X-Mailer: b4 0.12.3 Message-ID: <20230816-void-drivers-mtd-maps-physmap-versatile-v2-1-433a25272bfa@google.com> Subject: [PATCH v2] mtd: maps: fix -Wvoid-pointer-to-enum-cast warning From: Justin Stitt To: Linus Walleij , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Nathan Chancellor , Nick Desaulniers , Tom Rix Cc: Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Justin Stitt X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230816_112654_810752_D34ACA15 X-CRM114-Status: GOOD ( 12.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When building with clang 18 I see the following warning: | drivers/mtd/maps/physmap-versatile.c:209:25: warning: cast to smaller | integer type 'enum versatile_flashprot' from 'const void *' [-Wvoid-pointer-to-enum-cast] | 209 | versatile_flashprot = (enum versatile_flashprot)devid->data; This is due to the fact that `devid->data` is a void* while `enum versatile_flashprot` has the size of an int. Cast `devid->data` to a uintptr_t to silence the above warning for clang builds using W=1. Link: https://github.com/ClangBuiltLinux/linux/issues/1910 Reported-by: Nathan Chancellor Signed-off-by: Justin Stitt --- Changes in v2: - Use more accurate commit message (thanks Krzysztof) - Link to v1: https://lore.kernel.org/r/20230815-void-drivers-mtd-maps-physmap-versatile-v1-1-ba6fc86d5e4e@google.com --- drivers/mtd/maps/physmap-versatile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- base-commit: 2ccdd1b13c591d306f0401d98dedc4bdcd02b421 change-id: 20230815-void-drivers-mtd-maps-physmap-versatile-2270fe7fdf16 Best regards, -- Justin Stitt diff --git a/drivers/mtd/maps/physmap-versatile.c b/drivers/mtd/maps/physmap-versatile.c index a1b8b7b25f88..d65cf8833771 100644 --- a/drivers/mtd/maps/physmap-versatile.c +++ b/drivers/mtd/maps/physmap-versatile.c @@ -206,7 +206,7 @@ int of_flash_probe_versatile(struct platform_device *pdev, if (!sysnp) return -ENODEV; - versatile_flashprot = (enum versatile_flashprot)devid->data; + versatile_flashprot = (uintptr_t)devid->data; rmap = syscon_node_to_regmap(sysnp); of_node_put(sysnp); if (IS_ERR(rmap))