[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <557ACE07.3040104@roeck-us.net>
Date: Fri, 12 Jun 2015 05:18:15 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Stefan Wahren <info@...egoodbye.de>,
Noralf Trønnes <noralf@...nnes.org>,
linux-arm-kernel@...ts.infradead.org
CC: devicetree@...r.kernel.org, linux-watchdog@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-rpi-kernel@...ts.infradead.org
Subject: Re: [PATCH 2/3] watchdog: bcm2835: Add poweroff code for the Raspberry
Pi
On 06/12/2015 04:26 AM, Stefan Wahren wrote:
> Hi Noralf,
>
> Am 09.06.2015 um 12:21 schrieb Noralf Trønnes:
>> This adds a new poweroff function to the watchdog driver for the
>> Raspberry Pi. Currently poweroff/halt results in a reboot.
>>
>> [...]
>>
>> +static void rpi_power_off(void)
>> +{
>> + struct device_node *np =
>> + of_find_compatible_node(NULL, NULL, "brcm,raspberrypi-pm-wdt");
>> + struct platform_device *pdev = of_find_device_by_node(np);
>> + struct bcm2835_wdt *wdt = platform_get_drvdata(pdev);
>> + u32 val;
>> +
>> + val = readl_relaxed(wdt->base + PM_RSTS);
>
> do you think it's safe here to assume wdt could never be NULL?
>
If the call is made, the driver must be instantiated. We can therefore assume
that neither np, pdev, nor wdt is NULL. If one of those is NULL, it would be
a bug, which should not be ignored.
Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists