diff options
-rw-r--r-- | include/net/caif/cfserl.h | 1 | ||||
-rw-r--r-- | net/caif/cfcnfg.c | 2 | ||||
-rw-r--r-- | net/caif/cfserl.c | 6 |
3 files changed, 9 insertions, 0 deletions
diff --git a/include/net/caif/cfserl.h b/include/net/caif/cfserl.h index b8374321b36..8ac284c5de2 100644 --- a/include/net/caif/cfserl.h +++ b/include/net/caif/cfserl.h @@ -9,4 +9,5 @@ #include <net/caif/caif_layer.h> struct cflayer *cfserl_create(int type, int instance, bool use_stx); +void cfserl_destroy(struct cflayer *layer); #endif /* CFSERL_H_ */ diff --git a/net/caif/cfcnfg.c b/net/caif/cfcnfg.c index 52fe33bee02..7debfd4a031 100644 --- a/net/caif/cfcnfg.c +++ b/net/caif/cfcnfg.c @@ -521,6 +521,8 @@ got_phyid: frml = cffrml_create(phyid, fcs); if (!frml) { + if (phy_driver) + cfserl_destroy(phy_driver); pr_warn("Out of memory\n"); kfree(phyinfo); goto out; diff --git a/net/caif/cfserl.c b/net/caif/cfserl.c index 2715c84cfa8..403d57ad305 100644 --- a/net/caif/cfserl.c +++ b/net/caif/cfserl.c @@ -190,3 +190,9 @@ static void cfserl_ctrlcmd(struct cflayer *layr, enum caif_ctrlcmd ctrl, { layr->up->ctrlcmd(layr->up, ctrl, phyid); } + +void cfserl_destroy(struct cflayer *layer) +{ + struct cfserl *cfserl = container_obj(layer); + kfree(cfserl); +} |