summaryrefslogtreecommitdiff
path: root/drivers/nfc/nfcsim.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/nfc/nfcsim.c')
-rw-r--r--drivers/nfc/nfcsim.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/nfc/nfcsim.c b/drivers/nfc/nfcsim.c
index a466e7978466..33449820e754 100644
--- a/drivers/nfc/nfcsim.c
+++ b/drivers/nfc/nfcsim.c
@@ -482,8 +482,10 @@ static int __init nfcsim_init(void)
exit_err:
pr_err("Failed to initialize nfcsim driver (%d)\n", rc);
- nfcsim_link_free(link0);
- nfcsim_link_free(link1);
+ if (link0)
+ nfcsim_link_free(link0);
+ if (link1)
+ nfcsim_link_free(link1);
return rc;
}