[PATCH v2 2/5] rtc: zynqmp: check calibration max value

T, Harini Harini.T at amd.com
Wed Jan 14 07:35:36 PST 2026


[Public]

Reviewed-by: Harini T <harini.t at amd.com>

Thanks,
Harini T

> -----Original Message-----
> From: Tomas Melin <tomas.melin at vaisala.com>
> Sent: Thursday, January 8, 2026 6:21 PM
> To: Alexandre Belloni <alexandre.belloni at bootlin.com>; Simek, Michal
> <michal.simek at amd.com>
> Cc: linux-rtc at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux-
> kernel at vger.kernel.org; Tomas Melin <tomas.melin at vaisala.com>
> Subject: [PATCH v2 2/5] rtc: zynqmp: check calibration max value
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> Enable check to not overflow the calibration max value.
>
> Signed-off-by: Tomas Melin <tomas.melin at vaisala.com>
> ---
>  drivers/rtc/rtc-zynqmp.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c index
> 856bc1678e7d31144f320ae9f75fc58c742a2a64..caacce3725e2ef3803ea42d40
> e77ceaeb7d7b914 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));
>
> --
> 2.47.3
>



More information about the linux-arm-kernel mailing list