[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XEN v2 01/11] xen/ns16550: Remove unneeded truncation check in the DT init code


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
  • Date: Tue, 17 Jan 2023 17:43:48 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PB+0PNaaVLEQ5pWTn1e1aJdTj00MY9jH79kRwiJAuFg=; b=Dv6PvvEPGzxz+8RnbGax5C0Gxr8LFxzMh+x/uLqWy9Ue2VsZG4ftXaCkSW3Uz/li7flZhSPMXAGZnXxGI3wtKM/B4f0xaUNL8xOcsnSmJn/Uie9/GWeihIFt8shpnpe+PwW72AClWN4H34KTEuACePrgjk5mB1ewXzTKNDzUVkj/nAXJcRAfM0smM6HcTTSEcgg59P7YYh/yQDNtzCiVSK4US7kjVz/s3cmW8zVh7bvvCwL9Zjlk9SJ21p6kEulzs/Oy+tGAHcC3WcRYs0u6exFxQ2GzYsNoCf8QXdVrtNJWJlLY6toRO1Jr3UpSSJ4p0xDBEF97Qb6hMH7aKkvKfg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XNV7lckrRBEYlR5aLFTr4/LImzdTeNz4EfdEtnQsqPkfApJdvY2ZJw798B2HUt4fR0NlHI3Lhax+EfPTRpnOZLRpyNaUxQ3FfaEOSXm/NpYugV45/hFXcl4OJrl3ex1omtko75/6MczffwyJpHGS29eYX/yHT33C6ECnHczTCJNiAfLKOcKutBeNL0X99LHZFYK8gDXCD9X+BC8sUge1UTIR9x5DgJvZXPPywu08PDg3+QSVtwMdKpE4Bl5OYFlksnVFWVXe9EqUlI2CesKPNS8sbdaQ/+l8Z7jLMWpmpcEu6TcWzMCprwJ+qOu52aVacGLas52uazfdXa2F5jFVFA==
  • Cc: <sstabellini@xxxxxxxxxx>, <stefano.stabellini@xxxxxxx>, <julien@xxxxxxx>, <Volodymyr_Babchuk@xxxxxxxx>, <bertrand.marquis@xxxxxxx>, Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
  • Delivery-date: Tue, 17 Jan 2023 17:45:33 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

In an earlier commit (7c1de0038895), "ns16550.io_size" was u32 and
"io_size" was u64. Thus, the ASSERT() was needed to check if the values
are the same.
However, in a later commit (c9f8e0aee507), "ns16550.io_size" was changed
to u64. Thus, the ASSERT() became redundant.

So, now as "io_size" and "uart->io_size" are both u64, there will be no
truncation. Thus, one can remove the ASSERT() and extra assignment.

Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---

Changes from :

v1 - 1. Updated commit message/title.
2. Added Rb.

 xen/drivers/char/ns16550.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index 01a05c9aa8..58d0ccd889 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -1747,7 +1747,6 @@ static int __init ns16550_uart_dt_init(struct 
dt_device_node *dev,
     struct ns16550 *uart;
     int res;
     u32 reg_shift, reg_width;
-    u64 io_size;
 
     uart = &ns16550_com[0];
 
@@ -1758,14 +1757,10 @@ static int __init ns16550_uart_dt_init(struct 
dt_device_node *dev,
     uart->parity    = UART_PARITY_NONE;
     uart->stop_bits = 1;
 
-    res = dt_device_get_address(dev, 0, &uart->io_base, &io_size);
+    res = dt_device_get_address(dev, 0, &uart->io_base, &uart->io_size);
     if ( res )
         return res;
 
-    uart->io_size = io_size;
-
-    ASSERT(uart->io_size == io_size); /* Detect truncation */
-
     res = dt_property_read_u32(dev, "reg-shift", &reg_shift);
     if ( !res )
         uart->reg_shift = 0;
-- 
2.17.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.