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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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]

url:    https://github.com/0day-ci/linux/commits/Bartosz-Golaszewski/devres-provide-devm_kstrdup_const/20180827-162336
base:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
config: powerpc-mpc836x_mds_defconfig (attached as .config)
compiler: powerpc-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -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

    94	
    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;
   111	
   112		return devm_kstrdup(dev, s, gfp);
   113	}
   114	EXPORT_SYMBOL(devm_kstrdup_const);
   115	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux