Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp273689rdb; Tue, 5 Dec 2023 05:17:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFRHW3rnMnMi7qmhQbZzRTh7z7HPU3F+4ij2FTH3Z2uB6pUJQiuPT/+PS0mAZ+sMUKhSdq6 X-Received: by 2002:a05:6a00:13a6:b0:6ce:2731:d5b4 with SMTP id t38-20020a056a0013a600b006ce2731d5b4mr1130156pfg.37.1701782235864; Tue, 05 Dec 2023 05:17:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701782235; cv=none; d=google.com; s=arc-20160816; b=ydP/kvuILDcRaBXokMjr6SJTPj/Va3lU9hT/E9ML16LlnC7rBqTX6Za0AM05owNJLl xE/EcwAl6TuuNAqlsR9Gmy+wOcoxprklCTMThVgwPkzdPykKMNB08gmYj8aE7FuHm8kE wLF9tRrp3SrYVzy3SCMsO6ycysx5WXUvP40fmhiNcYZsSbembxissvgiv90U1Za8MT0e 0qKtl7bt021zx15K+ep/lOoGb5/udLV3RzWHA++gzNAfd6uxgFg5Vc/zj91fvC9bPgV1 UZiEtJV0XZtbMpV+c3XqZsFi81b8m+p+ZUptEV5B4qaqWW8yqhNBww3BnMH2wANPVtiJ x8cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=fNFMOajCjhtCBDQfEMtWoNNODjUog02BQHZ+nFkvQOw=; fh=L+JG6/cRdaiRNXzR6XAFyP0J5UMM9K1EL7qoJMsf4YY=; b=UYIHujpWiuk5BWs8rHJCjaYiitPl+Gp2R3ffKB/7Xg8yunMnAjjCG7Gbi5EwrPdWZD uYy/lG/g3hG3uuQLJ4mDTNCesSzeG8XRFS+tWMepFF8IewzzbSpFWPHAYnTuuWJ0ttoM GQUXduVYLsBEGUg+YTyGnQCDYeKFTLGtIIxnMvtirr03pGV5MYb7jZPjD88Bgyp4RrKM Ez4hr4FM+qseEa4N0IPSPvObTiHwY/zPamxUeR215EQVjctuuarAk3QNKDoVgbjXdZji 10TAi8TQ8mytUtnbJGgidKaCD7wdBaMi9/ZX8qqVrDaxRjCaQTGyDAzdPbmMsKzyFwTH 0hsw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=csgroup.eu Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id s16-20020a656450000000b005c677007fa1si4504007pgv.447.2023.12.05.05.17.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 05:17:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=csgroup.eu Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id E0B998022968; Tue, 5 Dec 2023 05:17:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345390AbjLENQ5 (ORCPT + 99 others); Tue, 5 Dec 2023 08:16:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232127AbjLENQ4 (ORCPT ); Tue, 5 Dec 2023 08:16:56 -0500 Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F84998 for ; Tue, 5 Dec 2023 05:17:01 -0800 (PST) Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4Sl1K76KdLz9v7D; Tue, 5 Dec 2023 14:16:59 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XSTOM1woJZj9; Tue, 5 Dec 2023 14:16:59 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4Sl1K75h5sz9v73; Tue, 5 Dec 2023 14:16:59 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id BEF238B773; Tue, 5 Dec 2023 14:16:59 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id ZmudtaQvGfeJ; Tue, 5 Dec 2023 14:16:59 +0100 (CET) Received: from PO20335.idsi0.si.c-s.fr (unknown [192.168.232.140]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 435AE8B763; Tue, 5 Dec 2023 14:16:59 +0100 (CET) From: Christophe Leroy To: Timur Tabi , Greg Kroah-Hartman , Jiri Slaby Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-serial@vger.kernel.org, kernel test robot Subject: [PATCH] serial: ucc_uart: Fix multiple address space type errors Date: Tue, 5 Dec 2023 14:16:43 +0100 Message-ID: X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1701782202; l=4378; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=7BbyDEsSN9lKWutzAJVNg1p+8y1zmI8jKsAum4TfjD4=; b=/415lG8SKvaAfW7b6eXqylnoXLy2KmYateqRHnTPn7UHwcQHwh+OrBjzFBzzGRrcVvbVNC5B8 AGNFI4BZiltDqxeBEOXRfCxMK/1KN6/dn7E9ypsAwcT4yUIMnfPW7ng X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 05 Dec 2023 05:17:13 -0800 (PST) sparse reports multiple problems with address space type. Most problems are linked to missing __iomem qualifier. Others are caused by dereferencing __iomem addresses. Fix all this by adding missing __iomem and using ioread32be(). Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202312050412.zN2PKArS-lkp@intel.com/ Signed-off-by: Christophe Leroy --- drivers/tty/serial/ucc_uart.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c index ed7a6bb5596a..25903d492023 100644 --- a/drivers/tty/serial/ucc_uart.c +++ b/drivers/tty/serial/ucc_uart.c @@ -189,10 +189,10 @@ struct uart_qe_port { u16 tx_fifosize; int wait_closing; u32 flags; - struct qe_bd *rx_bd_base; - struct qe_bd *rx_cur; - struct qe_bd *tx_bd_base; - struct qe_bd *tx_cur; + struct qe_bd __iomem *rx_bd_base; + struct qe_bd __iomem *rx_cur; + struct qe_bd __iomem *tx_bd_base; + struct qe_bd __iomem *tx_cur; unsigned char *tx_buf; unsigned char *rx_buf; void *bd_virt; /* virtual address of the BD buffers */ @@ -258,7 +258,7 @@ static unsigned int qe_uart_tx_empty(struct uart_port *port) { struct uart_qe_port *qe_port = container_of(port, struct uart_qe_port, port); - struct qe_bd *bdp = qe_port->tx_bd_base; + struct qe_bd __iomem *bdp = qe_port->tx_bd_base; while (1) { if (ioread16be(&bdp->status) & BD_SC_READY) @@ -330,7 +330,7 @@ static void qe_uart_stop_tx(struct uart_port *port) */ static int qe_uart_tx_pump(struct uart_qe_port *qe_port) { - struct qe_bd *bdp; + struct qe_bd __iomem *bdp; unsigned char *p; unsigned int count; struct uart_port *port = &qe_port->port; @@ -341,7 +341,7 @@ static int qe_uart_tx_pump(struct uart_qe_port *qe_port) /* Pick next descriptor and fill from buffer */ bdp = qe_port->tx_cur; - p = qe2cpu_addr(be32_to_cpu(bdp->buf), qe_port); + p = qe2cpu_addr(ioread32be(&bdp->buf), qe_port); *p++ = port->x_char; iowrite16be(1, &bdp->length); @@ -368,7 +368,7 @@ static int qe_uart_tx_pump(struct uart_qe_port *qe_port) while (!(ioread16be(&bdp->status) & BD_SC_READY) && !uart_circ_empty(xmit)) { count = 0; - p = qe2cpu_addr(be32_to_cpu(bdp->buf), qe_port); + p = qe2cpu_addr(ioread32be(&bdp->buf), qe_port); while (count < qe_port->tx_fifosize) { *p++ = xmit->buf[xmit->tail]; uart_xmit_advance(port, 1); @@ -460,7 +460,7 @@ static void qe_uart_int_rx(struct uart_qe_port *qe_port) unsigned char ch, *cp; struct uart_port *port = &qe_port->port; struct tty_port *tport = &port->state->port; - struct qe_bd *bdp; + struct qe_bd __iomem *bdp; u16 status; unsigned int flg; @@ -487,7 +487,7 @@ static void qe_uart_int_rx(struct uart_qe_port *qe_port) } /* get pointer */ - cp = qe2cpu_addr(be32_to_cpu(bdp->buf), qe_port); + cp = qe2cpu_addr(ioread32be(&bdp->buf), qe_port); /* loop through the buffer */ while (i-- > 0) { @@ -590,7 +590,7 @@ static void qe_uart_initbd(struct uart_qe_port *qe_port) { int i; void *bd_virt; - struct qe_bd *bdp; + struct qe_bd __iomem *bdp; /* Set the physical address of the host memory buffers in the buffer * descriptors, and the virtual address for us to work with. @@ -648,7 +648,7 @@ static void qe_uart_init_ucc(struct uart_qe_port *qe_port) { u32 cecr_subblock; struct ucc_slow __iomem *uccp = qe_port->uccp; - struct ucc_uart_pram *uccup = qe_port->uccup; + struct ucc_uart_pram __iomem *uccup = qe_port->uccup; unsigned int i; @@ -983,7 +983,7 @@ static int qe_uart_request_port(struct uart_port *port) qe_port->us_private = uccs; qe_port->uccp = uccs->us_regs; - qe_port->uccup = (struct ucc_uart_pram *) uccs->us_pram; + qe_port->uccup = (struct ucc_uart_pram __iomem *)uccs->us_pram; qe_port->rx_bd_base = uccs->rx_bd; qe_port->tx_bd_base = uccs->tx_bd; @@ -1156,7 +1156,7 @@ static void uart_firmware_cont(const struct firmware *fw, void *context) firmware = (struct qe_firmware *) fw->data; - if (firmware->header.length != fw->size) { + if (be32_to_cpu(firmware->header.length) != fw->size) { dev_err(dev, "invalid firmware\n"); goto out; } -- 2.41.0