]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
rpmsg: Constify local variable in field store macro
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tue, 19 Apr 2022 11:34:34 +0000 (13:34 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 22 Apr 2022 15:13:54 +0000 (17:13 +0200)
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>
drivers/rpmsg/rpmsg_core.c

index 79368a957d89c5f30acf5544c237e8138dc2ebdb..95fc283f6af78b8f3ea02b79d5b943099d893a15 100644 (file)
@@ -400,7 +400,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)                                                       \