From: David Miller <davem@davemloft.net>
To: andrew@lunn.ch
Cc: f.fainelli@gmail.com, netdev@vger.kernel.org,
vivien.didelot@savoirfairelinux.com
Subject: Re: [PATCH net-next 4/8] dsa: Move gpio reset into switch driver
Date: Wed, 13 Apr 2016 22:03:13 -0400 (EDT) [thread overview]
Message-ID: <20160413.220313.1257029315478740404.davem@davemloft.net> (raw)
In-Reply-To: <1460591998-20598-5-git-send-email-andrew@lunn.ch>
From: Andrew Lunn <andrew@lunn.ch>
Date: Thu, 14 Apr 2016 01:59:54 +0200
> @@ -3178,6 +3178,7 @@ int mv88e6xxx_probe(struct mdio_device *mdiodev, struct dsa_switch_driver *ops,
> struct mv88e6xxx_priv_state *ps;
> struct dsa_switch *ds;
> const char *name;
> + int err;
>
> ds = devm_kzalloc(dev, sizeof(*ds) + sizeof(*ps), GFP_KERNEL);
> if (!ds)
> @@ -3199,6 +3200,17 @@ int mv88e6xxx_probe(struct mdio_device *mdiodev, struct dsa_switch_driver *ops,
> return -ENODEV;
> }
>
> + ps->reset = devm_gpiod_get(&mdiodev->dev, "reset", GPIOD_ASIS);
> + err = PTR_ERR(ps->reset);
> + if (err) {
> + if (err == -ENOENT) {
> + /* Optional, so not an error */
> + ps->reset = NULL;
> + } else {
> + return err;
> + }
> + }
PTR_ERR() just casts the pointer into an integer, regardless of it's
value, and regardless of whether it is an error code or a real pointer
successfully returned from devm_gpiod_get().
So I don't think this code is correct.
You need an IS_ERR() check in there somewhere.
next prev parent reply other threads:[~2016-04-14 2:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-13 23:59 [PATCH net-next 0/8] DSA refactoring: set 2 Andrew Lunn
2016-04-13 23:59 ` [PATCH net-next 1/8] dsa: mv88e6xxx: Prepare for turning this into a library module Andrew Lunn
2016-04-14 20:22 ` Vivien Didelot
2016-04-14 21:26 ` Florian Fainelli
2016-04-14 21:37 ` Andrew Lunn
2016-04-14 21:49 ` David Miller
2016-04-14 21:32 ` Andrew Lunn
2016-04-13 23:59 ` [PATCH net-next 2/8] dsa: mv88e6xxx: Add macro for registering the drivers Andrew Lunn
2016-04-13 23:59 ` [PATCH net-next 3/8] dsa: Add mdio device support to Marvell switches Andrew Lunn
2016-04-13 23:59 ` [PATCH net-next 4/8] dsa: Move gpio reset into switch driver Andrew Lunn
2016-04-14 2:03 ` David Miller [this message]
2016-04-13 23:59 ` [PATCH net-next 5/8] dsa: mv88e6xxx: Kill the REG_READ and REG_WRITE macros Andrew Lunn
2016-04-14 14:54 ` Vivien Didelot
2016-04-13 23:59 ` [PATCH net-next 6/8] dsa: mv88e6xxx: Replace ds with ps where possible Andrew Lunn
2016-04-13 23:59 ` [PATCH net-next 7/8] dsa: mv88e6xxx: Use the name table to determine number of ports Andrew Lunn
2016-04-13 23:59 ` [PATCH net-next 8/8] dsa: mv88e6131: Don't special case a single device Andrew Lunn
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=20160413.220313.1257029315478740404.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=andrew@lunn.ch \
--cc=f.fainelli@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@savoirfairelinux.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).