mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-15 08:44:14 +08:00
rtc: ds1307: check for failed memory allocation on wdt
Currently a failed memory allocation will lead to a null pointer
dereference on point wdt. Fix this by checking for a failed
allocation and just returning.
Addresses-Coverity: ("Dereference null return")
Fixes: fd90d48db0
("rtc: ds1307: add support for watchdog timer on ds1388")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20200403110437.57420-1-colin.king@canonical.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
This commit is contained in:
parent
3edf29d9d5
commit
1821b79d6a
@ -1673,6 +1673,8 @@ static void ds1307_wdt_register(struct ds1307 *ds1307)
|
||||
return;
|
||||
|
||||
wdt = devm_kzalloc(ds1307->dev, sizeof(*wdt), GFP_KERNEL);
|
||||
if (!wdt)
|
||||
return;
|
||||
|
||||
wdt->info = &ds1388_wdt_info;
|
||||
wdt->ops = &ds1388_wdt_ops;
|
||||
|
Loading…
Reference in New Issue
Block a user