All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [rcar:gmsl/dev 35/38] drivers/regulator/gpio-regulator.c:245:17: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long int'
Date: Thu, 11 Jun 2020 00:27:32 +0800	[thread overview]
Message-ID: <202006110031.75MBaNJ4%lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 6329 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kbingham/rcar.git gmsl/dev
head:   406241b95becdda74baddd9c8eedbc2c376d9e23
commit: 6d19b4c1bce26c0057892422ad990598c85af4e5 [35/38] DNI: Regulator: Debug
config: ia64-randconfig-r034-20200608 (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 6d19b4c1bce26c0057892422ad990598c85af4e5
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=ia64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

In file included from include/linux/device.h:15,
from include/linux/platform_device.h:13,
from drivers/regulator/gpio-regulator.c:24:
drivers/regulator/gpio-regulator.c: In function 'gpio_regulator_probe':
>> drivers/regulator/gpio-regulator.c:245:17: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long int' [-Wformat=]
245 |    dev_err(dev, "OF_GET_GPIO_REGULATOR_CONFIG %dn", PTR_ERR(config));
|                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
|                      ^~~
>> drivers/regulator/gpio-regulator.c:245:4: note: in expansion of macro 'dev_err'
245 |    dev_err(dev, "OF_GET_GPIO_REGULATOR_CONFIG %dn", PTR_ERR(config));
|    ^~~~~~~
drivers/regulator/gpio-regulator.c:245:48: note: format string is defined here
245 |    dev_err(dev, "OF_GET_GPIO_REGULATOR_CONFIG %dn", PTR_ERR(config));
|                                               ~^
|                                                |
|                                                int
|                                               %ld

vim +245 drivers/regulator/gpio-regulator.c

   223	
   224	static int gpio_regulator_probe(struct platform_device *pdev)
   225	{
   226		struct device *dev = &pdev->dev;
   227		struct gpio_regulator_config *config = dev_get_platdata(dev);
   228		struct device_node *np = dev->of_node;
   229		struct gpio_regulator_data *drvdata;
   230		struct regulator_config cfg = { };
   231		struct regulator_dev *rdev;
   232		enum gpiod_flags gflags;
   233		int ptr, ret, state, i;
   234	
   235		drvdata = devm_kzalloc(dev, sizeof(struct gpio_regulator_data),
   236				       GFP_KERNEL);
   237		if (drvdata == NULL)
   238			return -ENOMEM;
   239	
   240		if (np) {
   241			config = of_get_gpio_regulator_config(dev, np,
   242							      &drvdata->desc);
   243	
   244			if (IS_ERR(config)) {
 > 245				dev_err(dev, "OF_GET_GPIO_REGULATOR_CONFIG %d\n", PTR_ERR(config));
   246				return PTR_ERR(config);
   247			}
   248		}
   249	
   250		dev_err(dev, "Probing GPIO Regulator\n");
   251	
   252		drvdata->desc.name = devm_kstrdup(dev, config->supply_name, GFP_KERNEL);
   253		if (drvdata->desc.name == NULL) {
   254			dev_err(dev, "Failed to allocate supply name\n");
   255			return -ENOMEM;
   256		}
   257	
   258		drvdata->gpiods = devm_kzalloc(dev, sizeof(struct gpio_desc *),
   259					       GFP_KERNEL);
   260		if (!drvdata->gpiods)
   261			return -ENOMEM;
   262	
   263		for (i = 0; i < config->ngpios; i++) {
   264			drvdata->gpiods[i] = devm_gpiod_get_index(dev,
   265								  NULL,
   266								  i,
   267								  config->gflags[i]);
   268			if (IS_ERR(drvdata->gpiods[i]))
   269				return PTR_ERR(drvdata->gpiods[i]);
   270			/* This is good to know */
   271			gpiod_set_consumer_name(drvdata->gpiods[i], drvdata->desc.name);
   272		}
   273		drvdata->nr_gpios = config->ngpios;
   274	
   275		drvdata->states = devm_kmemdup(dev,
   276					       config->states,
   277					       config->nr_states *
   278					       sizeof(struct gpio_regulator_state),
   279					       GFP_KERNEL);
   280		if (drvdata->states == NULL) {
   281			dev_err(dev, "Failed to allocate state data\n");
   282			return -ENOMEM;
   283		}
   284		drvdata->nr_states = config->nr_states;
   285	
   286		drvdata->desc.owner = THIS_MODULE;
   287		drvdata->desc.enable_time = config->startup_delay;
   288	
   289		/* handle regulator type*/
   290		switch (config->type) {
   291		case REGULATOR_VOLTAGE:
   292			drvdata->desc.type = REGULATOR_VOLTAGE;
   293			drvdata->desc.ops = &gpio_regulator_voltage_ops;
   294			drvdata->desc.n_voltages = config->nr_states;
   295			break;
   296		case REGULATOR_CURRENT:
   297			drvdata->desc.type = REGULATOR_CURRENT;
   298			drvdata->desc.ops = &gpio_regulator_current_ops;
   299			break;
   300		default:
   301			dev_err(dev, "No regulator type set\n");
   302			return -EINVAL;
   303		}
   304	
   305		/* build initial state from gpio init data. */
   306		state = 0;
   307		for (ptr = 0; ptr < drvdata->nr_gpios; ptr++) {
   308			if (config->gflags[ptr] == GPIOD_OUT_HIGH)
   309				state |= (1 << ptr);
   310		}
   311		drvdata->state = state;
   312	
   313		cfg.dev = dev;
   314		cfg.init_data = config->init_data;
   315		cfg.driver_data = drvdata;
   316		cfg.of_node = np;
   317	
   318		/*
   319		 * The signal will be inverted by the GPIO core if flagged so in the
   320		 * decriptor.
   321		 */
   322		if (config->enabled_at_boot)
   323			gflags = GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_NONEXCLUSIVE;
   324		else
   325			gflags = GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE;
   326	
   327		cfg.ena_gpiod = gpiod_get_optional(dev, "enable", gflags);
   328		if (IS_ERR(cfg.ena_gpiod))
   329			return PTR_ERR(cfg.ena_gpiod);
   330	
   331		rdev = devm_regulator_register(dev, &drvdata->desc, &cfg);
   332		if (IS_ERR(rdev)) {
   333			ret = PTR_ERR(rdev);
   334			dev_err(dev, "Failed to register regulator: %d\n", ret);
   335			return ret;
   336		}
   337	
   338		platform_set_drvdata(pdev, drvdata);
   339	
   340		return 0;
   341	}
   342	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 27834 bytes --]

             reply	other threads:[~2020-06-10 16:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-10 16:27 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-06-10 16:40 [rcar:gmsl/dev 35/38] drivers/regulator/gpio-regulator.c:245:17: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long int' kernel test robot
2020-04-09 15:10 kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202006110031.75MBaNJ4%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.