]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Input: rmi4 - use kzalloc_flex() for struct rmi_function
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 5 May 2026 04:59:41 +0000 (21:59 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 12 Jun 2026 05:39:28 +0000 (22:39 -0700)
struct rmi_function contains a flexible array member irq_mask.
Convert the manual kzalloc size calculation to use the kzalloc_flex()
macro.

Assisted-by: Gemini:gemini-3.1-pro
Link: https://patch.msgid.link/20260505045952.1570713-11-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/rmi4/rmi_bus.c

index c58866df555d53eaf81ea544555f3d772df5ef7b..560c85f533270ed3ea2b955c833fefcc55f79008 100644 (file)
@@ -242,9 +242,7 @@ struct rmi_function *rmi_alloc_function(struct rmi_device *rmi_dev, u8 id)
        struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev);
        struct rmi_function *fn;
 
-       fn = kzalloc(sizeof(*fn) +
-                       BITS_TO_LONGS(data->irq_count) * sizeof(unsigned long),
-                    GFP_KERNEL);
+       fn = kzalloc_flex(*fn, irq_mask, BITS_TO_LONGS(data->irq_count));
        if (!fn)
                return NULL;