From: Christian Lamparter Date: Tue, 15 Feb 2011 11:02:54 +0000 (+0100) Subject: carlu: fix error code propagation X-Git-Tag: 1.9.3~6^2 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=3616dc1adeae756cb4074b9de496a5ff2aa9c1d8;p=carl9170fw.git carlu: fix error code propagation Signed-off-by: Christian Lamparter --- diff --git a/tools/carlu/src/usb.c b/tools/carlu/src/usb.c index f242c97..ebc19a9 100644 --- a/tools/carlu/src/usb.c +++ b/tools/carlu/src/usb.c @@ -253,7 +253,7 @@ static void carlusb_zap_queues(struct carlu *ar) static void carlusb_free_driver(struct carlu *ar) { - if (ar) { + if (!IS_ERR_OR_NULL(ar)) { if (ar->event_pipe[0] > -1) close(ar->event_pipe[0]); @@ -303,7 +303,7 @@ static struct carlu *carlusb_open(void) err_out: carlusb_free_driver(tmp); - return NULL; + return ERR_PTR(err); } static void carlusb_cancel_rings(struct carlu *ar) @@ -692,8 +692,11 @@ struct carlu *carlusb_probe(void) int ret = -ENOMEM; ar = carlusb_open(); - if (ar == NULL) + if (IS_ERR_OR_NULL(ar)) { + if (IS_ERR(ar)) + ret = PTR_ERR(ar); goto err_out; + } ret = carlusb_show_devinfo(ar); if (ret) @@ -740,8 +743,7 @@ err_kill: err_out: carlusb_free_driver(ar); err("usb device rendezvous failed (%d).\n", ret); - - return NULL; + return ERR_PTR(ret); } void carlusb_close(struct carlu *ar)