All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Patrick Rudolph <patrick.rudolph@9elements.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	Linux Memory Management List <linux-mm@kvack.org>,
	Lee Jones <lee@kernel.org>,
	Naresh Solanki <Naresh.Solanki@9elements.com>
Subject: [linux-next:master 2799/2998] drivers/leds/leds-max5970.c:48:21: warning: variable 'num_leds' set but not used
Date: Fri, 24 Nov 2023 23:40:59 +0800	[thread overview]
Message-ID: <202311241836.JpSWGIRK-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   8c9660f6515396aba78d1168d2e17951d653ebf2
commit: 8171710be2d04fdc263da49212d7b875d3688f58 [2799/2998] leds: max5970: Add support for max5970
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20231124/202311241836.JpSWGIRK-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231124/202311241836.JpSWGIRK-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311241836.JpSWGIRK-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/leds/leds-max5970.c:48:21: warning: variable 'num_leds' set but not used [-Wunused-but-set-variable]
           int ret = -ENODEV, num_leds = 0;
                              ^
   1 warning generated.


vim +/num_leds +48 drivers/leds/leds-max5970.c

    40	
    41	static int max5970_led_probe(struct platform_device *pdev)
    42	{
    43		struct device *dev = &pdev->dev;
    44		struct device_node *np = dev_of_node(dev->parent);
    45		struct regmap *regmap;
    46		struct device_node *led_node, *child;
    47		struct max5970_led *ddata;
  > 48		int ret = -ENODEV, num_leds = 0;
    49	
    50		regmap = dev_get_regmap(pdev->dev.parent, NULL);
    51		if (!regmap)
    52			return -ENODEV;
    53	
    54		led_node = of_get_child_by_name(np, "leds");
    55		if (!led_node)
    56			return -ENODEV;
    57	
    58		for_each_available_child_of_node(led_node, child) {
    59			u32 reg;
    60	
    61			if (of_property_read_u32(child, "reg", &reg))
    62				continue;
    63	
    64			if (reg >= MAX5970_NUM_LEDS) {
    65				dev_err(dev, "invalid LED (%u >= %d)\n", reg, MAX5970_NUM_LEDS);
    66				continue;
    67			}
    68	
    69			ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL);
    70			if (!ddata) {
    71				of_node_put(child);
    72				return -ENOMEM;
    73			}
    74	
    75			ddata->index = reg;
    76			ddata->regmap = regmap;
    77			ddata->dev = dev;
    78	
    79			if (of_property_read_string(child, "label", &ddata->cdev.name))
    80				ddata->cdev.name = child->name;
    81	
    82			ddata->cdev.max_brightness = 1;
    83			ddata->cdev.brightness_set_blocking = max5970_led_set_brightness;
    84			ddata->cdev.default_trigger = "none";
    85	
    86			ret = devm_led_classdev_register(dev, &ddata->cdev);
    87			if (ret < 0) {
    88				of_node_put(child);
    89				dev_err(dev, "Failed to initialize LED %u\n", reg);
    90				return ret;
    91			}
    92			num_leds++;
    93		}
    94	
    95		return ret;
    96	}
    97	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2023-11-24 15:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202311241836.JpSWGIRK-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=Naresh.Solanki@9elements.com \
    --cc=lee@kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=patrick.rudolph@9elements.com \
    /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.