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

[XEN v3 1/9] xen/ns16550: Remove unneeded truncation check in the DT init code


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
  • Date: Wed, 8 Feb 2023 12:05:21 +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=CAZmFKeEHcYbCwG62zO7gEcvYWFvdpCtigxTazP649I=; b=eOiZdUFJWpwGcTGYAmRKnO3lqQKxVfJ02n4e+Byl6iYzvyVLf/JedY3HA1e0WFfQHicmS4O/z6sLT29UBi+kcHKNmRoiGhs7xc44umxbM78+lqfjSXaLXolRasNE6okadiC9wYbnEt8/b+06dOjVHitZs4d0yRFBlh39VJRkaa14THrC228T4IkiJGVEs42zztjwwHt1/ya3t1jk2bVvfDoStd37EvOhEhpoJ+JdpnGNQTfdHxssID0kSvNxfn/W8bRlwMi75nsv8NTjVN5pRQ8WkP/v1p1SNTy5sYeUS00kn/ljO6g9ol9IXTsKUDtzTVNc7QCcoiq3oRGjyIi9Ug==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TCw7PNGMOtLaHOGhrmqRQSUbkbiK94N1v0suR229ELqslmbPWlM2bwAA0+8MBDrwhitD93gZWgrFGkBOdZdHCkpfEujy0CmGgoJTsrehGIRUCrPuAUtXLXRD1Lp1Xhf+8i5djgC5U3gxRnObjaeR4Z9DrwtoMmzeYypChL6GXGJaUnUBhUsOBoT0JAiQMYIeODd3JPvO63ked2rDYrPTrtNGpJeodNyUJgwXNe5cIKp61urd445Ly/jMlJJXIkNrKHbl9tIaCDLzO5v6j86xBS5OCWDsnhvZSPNOjgL3Gy+N+i9oMfcC9iiZC80liVqIhvShoI9uV5HHIv/ZCkhmoQ==
  • Cc: <sstabellini@xxxxxxxxxx>, <stefano.stabellini@xxxxxxx>, <julien@xxxxxxx>, <Volodymyr_Babchuk@xxxxxxxx>, <bertrand.marquis@xxxxxxx>, <andrew.cooper3@xxxxxxxxxx>, <george.dunlap@xxxxxxxxxx>, <jbeulich@xxxxxxxx>, <wl@xxxxxxx>, <rahul.singh@xxxxxxx>, Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
  • Delivery-date: Wed, 08 Feb 2023 12:06:05 +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. 

v2 - No change.

 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 4ce74b3cd3..092f6b9c4b 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®.