summaryrefslogtreecommitdiff
path: root/drivers/serial
diff options
context:
space:
mode:
authorAndrew Goodbody <[email protected]>2025-08-11 18:03:40 +0100
committerCasey Connolly <[email protected]>2025-08-13 15:17:36 +0200
commit10e65926a37d06831fc913221f9eb930c4194060 (patch)
treeea05f57f8409b12800da66aae107fe67c38cd522 /drivers/serial
parentf236451cb426fc3edaf756dac6346cd6273179b8 (diff)
serial: msm-geni: No need to NULL check priv
The NULL check for priv in qcom_geni_serial_poll_bit serves no useful prupose as too much other code surrounding it relies on priv being valid. Remove the NULL check for priv and other related code. This issue was found by Smatch. Signed-off-by: Andrew Goodbody <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Casey Connolly <[email protected]>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/serial_msm_geni.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/drivers/serial/serial_msm_geni.c b/drivers/serial/serial_msm_geni.c
index 33016f0cb53..0eb90f82a34 100644
--- a/drivers/serial/serial_msm_geni.c
+++ b/drivers/serial/serial_msm_geni.c
@@ -288,23 +288,19 @@ static bool qcom_geni_serial_poll_bit(const struct udevice *dev, int offset,
unsigned int tx_fifo_depth;
unsigned int tx_fifo_width;
unsigned int fifo_bits;
- unsigned long timeout_us = 10000;
-
- baud = 115200;
-
- if (priv) {
- baud = priv->baud;
- if (!baud)
- baud = 115200;
- tx_fifo_depth = geni_se_get_tx_fifo_depth(priv->base);
- tx_fifo_width = geni_se_get_tx_fifo_width(priv->base);
- fifo_bits = tx_fifo_depth * tx_fifo_width;
- /*
- * Total polling iterations based on FIFO worth of bytes to be
- * sent at current baud. Add a little fluff to the wait.
- */
- timeout_us = ((fifo_bits * USEC_PER_SEC) / baud) + 500;
- }
+ unsigned long timeout_us;
+
+ baud = priv->baud;
+ if (!baud)
+ baud = 115200;
+ tx_fifo_depth = geni_se_get_tx_fifo_depth(priv->base);
+ tx_fifo_width = geni_se_get_tx_fifo_width(priv->base);
+ fifo_bits = tx_fifo_depth * tx_fifo_width;
+ /*
+ * Total polling iterations based on FIFO worth of bytes to be
+ * sent at current baud. Add a little fluff to the wait.
+ */
+ timeout_us = ((fifo_bits * USEC_PER_SEC) / baud) + 500;
timeout_us = DIV_ROUND_UP(timeout_us, 10) * 10;
while (timeout_us) {