netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: <nicolas.ferre@atmel.com>, <davem@davemloft.net>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<patches@opensource.wolfsonmicro.com>
Subject: Re: [PATCH] net: macb: Only call GPIO functions if there is a valid GPIO
Date: Tue, 29 Mar 2016 09:28:36 +0100	[thread overview]
Message-ID: <20160329082836.GD31814@localhost.localdomain> (raw)
In-Reply-To: <56F96A23.4000001@cogentembedded.com>

On Mon, Mar 28, 2016 at 08:30:11PM +0300, Sergei Shtylyov wrote:
> >@@ -3029,7 +3030,8 @@ static int macb_remove(struct platform_device *pdev)
> >  		mdiobus_free(bp->mii_bus);
> >
> >  		/* Shutdown the PHY if there is a GPIO reset */
> >-		gpiod_set_value(bp->reset_gpio, 0);
> >+		if (bp->reset_gpio)
> >+			gpiod_set_value(bp->reset_gpio, 0);
> 
>    Hm, this function was previously OK to call with NULL (it didn't curse)...
> 

Looks like it was changed so that it does complain fairly
recently (patch librally snipped down):

commit fdeb8e1547cb9dd39d5d7223b33f3565cf86c28e
Author: Linus Walleij <linus.walleij@linaro.org>

    gpio: reflect base and ngpio into gpio_device


+#define VALIDATE_DESC_VOID(desc) do { \
+ if (!desc || !desc->gdev) { \
+         pr_warn("%s: invalid GPIO\n", __func__); \
+         return; \
+ } \
+

void gpiod_set_value(struct gpio_desc *desc, int value)
{
-   if (!desc)
-           return;
+ VALIDATE_DESC_VOID(desc);

Thanks,
Charles

      reply	other threads:[~2016-03-29  8:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-28 12:47 [PATCH] net: macb: Only call GPIO functions if there is a valid GPIO Charles Keepax
2016-03-28 15:40 ` David Miller
2016-03-28 17:30 ` Sergei Shtylyov
2016-03-29  8:28   ` Charles Keepax [this message]

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=20160329082836.GD31814@localhost.localdomain \
    --to=ckeepax@opensource.wolfsonmicro.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@atmel.com \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=sergei.shtylyov@cogentembedded.com \
    /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;
as well as URLs for NNTP newsgroup(s).