netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] dm9000: Return an ERR_PTR() in all error conditions of dm9000_parse_dt()
@ 2014-09-19 14:16 Tobias Klauser
  2014-09-22 20:03 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Klauser @ 2014-09-19 14:16 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

In one error condition dm9000_parse_dt() returns NULL, however the
return value is checked using IS_ERR() in dm9000_probe(), leading to the
error not being properly propagated if CONFIG_OF is not enabled or the
device tree data is not available. Fix this by also returning an
ERR_PTR() in this case.

Fixes: 0b8bf1baabe5 (net: dm9000: Allow instantiation using device tree)
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
 drivers/net/ethernet/davicom/dm9000.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
index 9b33057..70089c2 100644
--- a/drivers/net/ethernet/davicom/dm9000.c
+++ b/drivers/net/ethernet/davicom/dm9000.c
@@ -1399,7 +1399,7 @@ static struct dm9000_plat_data *dm9000_parse_dt(struct device *dev)
 	const void *mac_addr;
 
 	if (!IS_ENABLED(CONFIG_OF) || !np)
-		return NULL;
+		return ERR_PTR(-ENXIO);
 
 	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
 	if (!pdata)
-- 
2.0.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] dm9000: Return an ERR_PTR() in all error conditions of dm9000_parse_dt()
  2014-09-19 14:16 [PATCH net] dm9000: Return an ERR_PTR() in all error conditions of dm9000_parse_dt() Tobias Klauser
@ 2014-09-22 20:03 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-09-22 20:03 UTC (permalink / raw)
  To: tklauser; +Cc: netdev

From: Tobias Klauser <tklauser@distanz.ch>
Date: Fri, 19 Sep 2014 16:16:25 +0200

> In one error condition dm9000_parse_dt() returns NULL, however the
> return value is checked using IS_ERR() in dm9000_probe(), leading to the
> error not being properly propagated if CONFIG_OF is not enabled or the
> device tree data is not available. Fix this by also returning an
> ERR_PTR() in this case.
> 
> Fixes: 0b8bf1baabe5 (net: dm9000: Allow instantiation using device tree)
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-22 20:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-19 14:16 [PATCH net] dm9000: Return an ERR_PTR() in all error conditions of dm9000_parse_dt() Tobias Klauser
2014-09-22 20:03 ` David Miller

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).