Re: [PATCH 1/2] devres: provide devm_kstrdup_const()

From: kbuild test robot
Date: Mon Aug 27 2018 - 08:48:11 EST

Hi Bartosz,

I love your patch! Perhaps something to improve:

[auto build test WARNING on clk/clk-next]
[also build test WARNING on v4.19-rc1 next-20180827]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

base: clk-next
config: powerpc-mpc836x_mds_defconfig (attached as .config)
compiler: powerpc-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
wget -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=powerpc

All warnings (new ones prefixed by >>):

mm/util.c: In function 'devm_kstrdup_const':
>> mm/util.c:110:10: warning: return discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
return s;

vim +/const +110 mm/util.c

95 /**
96 * devm_kstrdup_const - resource managed conditional string duplication
97 * @dev: device for which to duplicate the string
98 * @s: the string to duplicate
99 * @gfp: the GFP mask used in the kmalloc() call when allocating memory
100 *
101 * Function returns source string if it is in .rodata section otherwise it
102 * fallbacks to devm_kstrdup.
103 *
104 * Strings allocated by devm_kstrdup_const will be automatically freed when
105 * the associated device is detached.
106 */
107 char *devm_kstrdup_const(struct device *dev, const char *s, gfp_t gfp)
108 {
109 if (is_kernel_rodata((unsigned long)s))
> 110 return s;
112 return devm_kstrdup(dev, s, gfp);
113 }
114 EXPORT_SYMBOL(devm_kstrdup_const);

0-DAY kernel test infrastructure Open Source Technology Center Intel Corporation

Attachment: .config.gz
Description: application/gzip