Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1365992
| From | Charles Keepax <ckeepax@opensource.wolfsonmicro.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] net: macb: Only call GPIO functions if there is a valid GPIO |
| Date | 2016-03-29 10:30 +0200 |
| Message-ID | <rhXce-3ke-3@gated-at.bofh.it> (permalink) |
| References | <rhEMi-78o-19@gated-at.bofh.it> <rhJiW-1Rg-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] net: macb: Only call GPIO functions if there is a valid GPIO Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2016-03-28 14:50 +0200
Re: [PATCH] net: macb: Only call GPIO functions if there is a valid GPIO David Miller <davem@davemloft.net> - 2016-03-28 17:50 +0200
Re: [PATCH] net: macb: Only call GPIO functions if there is a valid GPIO Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-03-28 19:40 +0200
Re: [PATCH] net: macb: Only call GPIO functions if there is a valid GPIO Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2016-03-29 10:30 +0200
csiph-web