diff options
| author | Tomas Melin <tomas.melin@vaisala.com> | 2026-01-22 16:53:46 +0300 |
|---|---|---|
| committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2026-01-29 18:44:37 +0300 |
| commit | 83b9e5eb043710190f6461729fa2e05320a6594d (patch) | |
| tree | e4161e75ed2c70c0f20ab16aefa3d3fc75218ac4 | |
| parent | 2724fb4d429cbb724dcb6fa17953040918ebe3a2 (diff) | |
| download | linux-83b9e5eb043710190f6461729fa2e05320a6594d.tar.xz | |
rtc: zynqmp: check calibration max value
Enable check to not overflow the calibration
max value.
Reviewed-by: Harini T <harini.t@amd.com>
Tested-by: Harini T <harini.t@amd.com>
Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
Acked-by: Michal Simek <michal.simek@amd.com>
Link: https://patch.msgid.link/20260122-zynqmp-rtc-updates-v4-2-d4edb966b499@vaisala.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
| -rw-r--r-- | drivers/rtc/rtc-zynqmp.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c index 856bc1678e7d..caacce3725e2 100644 --- a/drivers/rtc/rtc-zynqmp.c +++ b/drivers/rtc/rtc-zynqmp.c @@ -349,6 +349,11 @@ static int xlnx_rtc_probe(struct platform_device *pdev) xrtcdev->freq--; } + if (xrtcdev->freq > RTC_TICK_MASK) { + dev_err(&pdev->dev, "Invalid RTC calibration value\n"); + return -EINVAL; + } + ret = readl(xrtcdev->reg_base + RTC_CALIB_RD); if (!ret) writel(xrtcdev->freq, (xrtcdev->reg_base + RTC_CALIB_WR)); |
