dba18c6fc689c8dd824077ae9a73fd3f1c07f47d
[openwrt/staging/ynezz.git] /
1 From c518032ec09c3e21872a5b2f9114655d55d9ade1 Mon Sep 17 00:00:00 2001
2 From: Tim Gover <tim.gover@raspberrypi.org>
3 Date: Thu, 22 Oct 2020 15:30:55 +0100
4 Subject: [PATCH] watchdog: bcm2835: Ignore params after the partition
5 number
6
7 Use sscanf to extract the partition number and ignore extra parameters
8 which are only relevant to other reboot notifiers.
9 ---
10 drivers/watchdog/bcm2835_wdt.c | 6 ++++--
11 1 file changed, 4 insertions(+), 2 deletions(-)
12
13 --- a/drivers/watchdog/bcm2835_wdt.c
14 +++ b/drivers/watchdog/bcm2835_wdt.c
15 @@ -126,10 +126,12 @@ static int bcm2835_restart(struct watchd
16 {
17 struct bcm2835_wdt *wdt = watchdog_get_drvdata(wdog);
18
19 - unsigned long long val;
20 + unsigned long val;
21 u8 partition = 0;
22
23 - if (data && !kstrtoull(data, 0, &val) && val <= 63)
24 + // Allow extra arguments separated by spaces after
25 + // the partition number.
26 + if (data && sscanf(data, "%lu", &val) && val < 63)
27 partition = val;
28
29 __bcm2835_restart(wdt, partition);