public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: "Stefan Wahren" <info@lategoodbye.de>,
	"Noralf Trønnes" <noralf@tronnes.org>,
	linux-arm-kernel@lists.infradead.org
Cc: devicetree@vger.kernel.org, linux-watchdog@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-rpi-kernel@lists.infradead.org
Subject: Re: [PATCH 2/3] watchdog: bcm2835: Add poweroff code for the Raspberry Pi
Date: Fri, 12 Jun 2015 05:18:15 -0700	[thread overview]
Message-ID: <557ACE07.3040104@roeck-us.net> (raw)
In-Reply-To: <557AC203.6060600@lategoodbye.de>

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


  reply	other threads:[~2015-06-12 12:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-09 10:21 [PATCH 1/3] dt-bindings: Add Raspberry Pi compatible string for watchdog Noralf Trønnes
2015-06-09 10:21 ` [PATCH 2/3] watchdog: bcm2835: Add poweroff code for the Raspberry Pi Noralf Trønnes
2015-06-12 11:26   ` Stefan Wahren
2015-06-12 12:18     ` Guenter Roeck [this message]
2015-06-12 12:23   ` Guenter Roeck
2015-06-09 10:21 ` [PATCH 3/3] ARM: dts: bcm2835-rpi: Add "brcm,raspberrypi-pm-wdt" to wdt compatible Noralf Trønnes
2015-06-13  6:46 ` [PATCH 1/3] dt-bindings: Add Raspberry Pi compatible string for watchdog Jeff Epler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=557ACE07.3040104@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=devicetree@vger.kernel.org \
    --cc=info@lategoodbye.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=noralf@tronnes.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox