]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
rpmsg: Constify local variable in field store macro
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tue, 31 Oct 2023 11:25:36 +0000 (11:25 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Nov 2023 16:26:44 +0000 (17:26 +0100)
commit e5f89131a06142e91073b6959d91cea73861d40e upstream.

Memory pointed by variable 'old' in field store macro is not modified,
so it can be made a pointer to const.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220419113435.246203-12-krzysztof.kozlowski@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Lee Jones <lee@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/rpmsg/rpmsg_core.c

index a71de08acc7b9cfea1610603db5d28bfcaa9bc28..c544dee0b5dd929442301f1bc6d50a7cfe83fdc7 100644 (file)
@@ -376,7 +376,8 @@ field##_store(struct device *dev, struct device_attribute *attr,    \
              const char *buf, size_t sz)                               \
 {                                                                      \
        struct rpmsg_device *rpdev = to_rpmsg_device(dev);              \
-       char *new, *old;                                                \
+       const char *old;                                                \
+       char *new;                                                      \
                                                                        \
        new = kstrndup(buf, sz, GFP_KERNEL);                            \
        if (!new)                                                       \