diff options
Diffstat (limited to 'xpp/mpp_funcs.c')
-rw-r--r-- | xpp/mpp_funcs.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/xpp/mpp_funcs.c b/xpp/mpp_funcs.c index 61868db..c52397f 100644 --- a/xpp/mpp_funcs.c +++ b/xpp/mpp_funcs.c @@ -928,14 +928,19 @@ struct astribank_device *mpp_init(const char devpath[]) ret = mpp_proto_query(astribank); if(ret < 0) { ERR("Protocol handshake failed: %d\n", ret); - return NULL; + goto err; } ret = mpp_status_query(astribank); if(ret < 0) { ERR("Status query failed: %d\n", ret); - return NULL; + goto err; } return astribank; + +err: + if (astribank) + astribank_close(astribank, 0); + return NULL; } void mpp_exit(struct astribank_device *astribank) |