Merge 5.16-rc8 into usb-next
[linux-2.6-microblaze.git] / drivers / usb / gadget / function / f_fs.c
index 3c584da..25ad1e9 100644 (file)
@@ -1773,11 +1773,15 @@ static void ffs_data_clear(struct ffs_data *ffs)
 
        BUG_ON(ffs->gadget);
 
-       if (ffs->epfiles)
+       if (ffs->epfiles) {
                ffs_epfiles_destroy(ffs->epfiles, ffs->eps_count);
+               ffs->epfiles = NULL;
+       }
 
-       if (ffs->ffs_eventfd)
+       if (ffs->ffs_eventfd) {
                eventfd_ctx_put(ffs->ffs_eventfd);
+               ffs->ffs_eventfd = NULL;
+       }
 
        kfree(ffs->raw_descs_data);
        kfree(ffs->raw_strings);
@@ -1790,7 +1794,6 @@ static void ffs_data_reset(struct ffs_data *ffs)
 
        ffs_data_clear(ffs);
 
-       ffs->epfiles = NULL;
        ffs->raw_descs_data = NULL;
        ffs->raw_descs = NULL;
        ffs->raw_strings = NULL;