usb: gadget: f_mass_storage: Remove kref structure use

The kref structure is locally to f_mass_storage and is not used
anywhere beside in fsg_common_release().

Remove it and use struct fsg_common* instead.

No functional change.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Zixun LI <admin@hifiphile.com> # on SAM9X60
Link: https://lore.kernel.org/r/20250328-ums-gadget-leak-v1-1-3b677db99bde@baylibre.com
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
This commit is contained in:
Mattijs Korpershoek
2025-03-28 09:15:41 +01:00
committed by Mattijs Korpershoek
parent d3c9f810f2
commit a4317be9db

View File

@@ -284,7 +284,6 @@ static const char fsg_string_interface[] = "Mass Storage";
#define kthread_create(...) __builtin_return_address(0)
#define wait_for_completion(...) do {} while (0)
struct kref {int x; };
struct completion {int x; };
struct fsg_dev;
@@ -345,8 +344,6 @@ struct fsg_common {
/* Vendor (8 chars), product (16 chars), release (4
* hexadecimal digits) and NUL byte */
char inquiry_string[8 + 16 + 4 + 1];
struct kref ref;
};
struct fsg_config {
@@ -2436,7 +2433,7 @@ int fsg_main_thread(void *common_)
return 0;
}
static void fsg_common_release(struct kref *ref);
static void fsg_common_release(struct fsg_common *common);
static struct fsg_common *fsg_common_init(struct fsg_common *common,
struct usb_composite_dev *cdev)
@@ -2548,16 +2545,12 @@ error_luns:
common->nluns = i + 1;
error_release:
common->state = FSG_STATE_TERMINATED; /* The thread is dead */
/* Call fsg_common_release() directly, ref might be not
* initialised */
fsg_common_release(&common->ref);
fsg_common_release(common);
return ERR_PTR(rc);
}
static void fsg_common_release(struct kref *ref)
static void fsg_common_release(struct fsg_common *common)
{
struct fsg_common *common = container_of(ref, struct fsg_common, ref);
/* If the thread isn't already dead, tell it to exit now */
if (common->state != FSG_STATE_TERMINATED) {
raise_exception(common, FSG_STATE_EXIT);