All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: "Clément Léger" <clement.leger@bootlin.com>
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org
Subject: Re: [RFC 10/10] net: sfp: add support for fwnode
Date: Tue, 22 Feb 2022 05:48:49 +0800	[thread overview]
Message-ID: <202202220543.PIagZaL4-lkp@intel.com> (raw)
In-Reply-To: <20220221162652.103834-11-clement.leger@bootlin.com>

Hi "Clément,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on wsa/i2c/for-next]
[also build test WARNING on driver-core/driver-core-testing linus/master v5.17-rc5 next-20220217]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Cl-ment-L-ger/add-support-for-fwnode-in-i2c-mux-system-and-sfp/20220222-004129
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
config: arm-randconfig-r034-20220221 (https://download.01.org/0day-ci/archive/20220222/202202220543.PIagZaL4-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
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
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://github.com/0day-ci/linux/commit/88ff2fe34392c6bdae43f555e0d1373fecab434f
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Cl-ment-L-ger/add-support-for-fwnode-in-i2c-mux-system-and-sfp/20220222-004129
        git checkout 88ff2fe34392c6bdae43f555e0d1373fecab434f
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/net/phy/

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 >>):

>> drivers/net/phy/sfp.c:2502:6: warning: variable 'i2c' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (dev_fwnode(&pdev->dev)) {
               ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net/phy/sfp.c:2523:7: note: uninitialized use occurs here
           if (!i2c)
                ^~~
   drivers/net/phy/sfp.c:2502:2: note: remove the 'if' if its condition is always true
           if (dev_fwnode(&pdev->dev)) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/phy/sfp.c:2486:25: note: initialize the variable 'i2c' to silence this warning
           struct i2c_adapter *i2c;
                                  ^
                                   = NULL
   1 warning generated.


vim +2502 drivers/net/phy/sfp.c

  2482	
  2483	static int sfp_probe(struct platform_device *pdev)
  2484	{
  2485		const struct sff_data *sff;
  2486		struct i2c_adapter *i2c;
  2487		char *sfp_irq_name;
  2488		struct sfp *sfp;
  2489		int err, i;
  2490	
  2491		sfp = sfp_alloc(&pdev->dev);
  2492		if (IS_ERR(sfp))
  2493			return PTR_ERR(sfp);
  2494	
  2495		platform_set_drvdata(pdev, sfp);
  2496	
  2497		err = devm_add_action(sfp->dev, sfp_cleanup, sfp);
  2498		if (err < 0)
  2499			return err;
  2500	
  2501		sff = sfp->type = &sfp_data;
> 2502		if (dev_fwnode(&pdev->dev)) {
  2503			struct fwnode_handle *fwnode = dev_fwnode(&pdev->dev);
  2504			struct fwnode_handle *np;
  2505	
  2506			if (!is_acpi_device_node(fwnode)) {
  2507				sff = device_get_match_data(&pdev->dev);
  2508				if (WARN_ON(!sff))
  2509					return -EINVAL;
  2510	
  2511				sfp->type = sff;
  2512			}
  2513	
  2514			np = fwnode_find_reference(fwnode, "i2c-bus", 0);
  2515			if (!np) {
  2516				dev_err(&pdev->dev, "Cannot parse i2c-bus\n");
  2517				return -ENODEV;
  2518			}
  2519			i2c = fwnode_find_i2c_adapter_by_node(np);
  2520			fwnode_handle_put(np);
  2521		}
  2522	
  2523		if (!i2c)
  2524			return -EPROBE_DEFER;
  2525	
  2526		err = sfp_i2c_configure(sfp, i2c);
  2527		if (err < 0) {
  2528			i2c_put_adapter(i2c);
  2529			return err;
  2530		}
  2531	
  2532		for (i = 0; i < GPIO_MAX; i++)
  2533			if (sff->gpios & BIT(i)) {
  2534				sfp->gpio[i] = devm_gpiod_get_optional(sfp->dev,
  2535						   gpio_of_names[i], gpio_flags[i]);
  2536				if (IS_ERR(sfp->gpio[i]))
  2537					return PTR_ERR(sfp->gpio[i]);
  2538			}
  2539	
  2540		sfp->get_state = sfp_gpio_get_state;
  2541		sfp->set_state = sfp_gpio_set_state;
  2542	
  2543		/* Modules that have no detect signal are always present */
  2544		if (!(sfp->gpio[GPIO_MODDEF0]))
  2545			sfp->get_state = sff_gpio_get_state;
  2546	
  2547		device_property_read_u32(&pdev->dev, "maximum-power-milliwatt",
  2548					 &sfp->max_power_mW);
  2549		if (!sfp->max_power_mW)
  2550			sfp->max_power_mW = 1000;
  2551	
  2552		dev_info(sfp->dev, "Host maximum power %u.%uW\n",
  2553			 sfp->max_power_mW / 1000, (sfp->max_power_mW / 100) % 10);
  2554	
  2555		/* Get the initial state, and always signal TX disable,
  2556		 * since the network interface will not be up.
  2557		 */
  2558		sfp->state = sfp_get_state(sfp) | SFP_F_TX_DISABLE;
  2559	
  2560		if (sfp->gpio[GPIO_RATE_SELECT] &&
  2561		    gpiod_get_value_cansleep(sfp->gpio[GPIO_RATE_SELECT]))
  2562			sfp->state |= SFP_F_RATE_SELECT;
  2563		sfp_set_state(sfp, sfp->state);
  2564		sfp_module_tx_disable(sfp);
  2565		if (sfp->state & SFP_F_PRESENT) {
  2566			rtnl_lock();
  2567			sfp_sm_event(sfp, SFP_E_INSERT);
  2568			rtnl_unlock();
  2569		}
  2570	
  2571		for (i = 0; i < GPIO_MAX; i++) {
  2572			if (gpio_flags[i] != GPIOD_IN || !sfp->gpio[i])
  2573				continue;
  2574	
  2575			sfp->gpio_irq[i] = gpiod_to_irq(sfp->gpio[i]);
  2576			if (sfp->gpio_irq[i] < 0) {
  2577				sfp->gpio_irq[i] = 0;
  2578				sfp->need_poll = true;
  2579				continue;
  2580			}
  2581	
  2582			sfp_irq_name = devm_kasprintf(sfp->dev, GFP_KERNEL,
  2583						      "%s-%s", dev_name(sfp->dev),
  2584						      gpio_of_names[i]);
  2585	
  2586			if (!sfp_irq_name)
  2587				return -ENOMEM;
  2588	
  2589			err = devm_request_threaded_irq(sfp->dev, sfp->gpio_irq[i],
  2590							NULL, sfp_irq,
  2591							IRQF_ONESHOT |
  2592							IRQF_TRIGGER_RISING |
  2593							IRQF_TRIGGER_FALLING,
  2594							sfp_irq_name, sfp);
  2595			if (err) {
  2596				sfp->gpio_irq[i] = 0;
  2597				sfp->need_poll = true;
  2598			}
  2599		}
  2600	
  2601		if (sfp->need_poll)
  2602			mod_delayed_work(system_wq, &sfp->poll, poll_jiffies);
  2603	
  2604		/* We could have an issue in cases no Tx disable pin is available or
  2605		 * wired as modules using a laser as their light source will continue to
  2606		 * be active when the fiber is removed. This could be a safety issue and
  2607		 * we should at least warn the user about that.
  2608		 */
  2609		if (!sfp->gpio[GPIO_TX_DISABLE])
  2610			dev_warn(sfp->dev,
  2611				 "No tx_disable pin: SFP modules will always be emitting.\n");
  2612	
  2613		sfp->sfp_bus = sfp_register_socket(sfp->dev, sfp, &sfp_module_ops);
  2614		if (!sfp->sfp_bus)
  2615			return -ENOMEM;
  2616	
  2617		sfp_debugfs_init(sfp);
  2618	
  2619		return 0;
  2620	}
  2621	

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

  parent reply	other threads:[~2022-02-21 21:49 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-21 16:26 [RFC 00/10] add support for fwnode in i2c mux system and sfp Clément Léger
2022-02-21 16:26 ` [RFC 01/10] property: add fwnode_match_node() Clément Léger
2022-02-21 17:44   ` Andy Shevchenko
2022-02-22  8:14     ` Clément Léger
2022-02-21 16:26 ` [RFC 02/10] property: add fwnode_get_match_data() Clément Léger
2022-02-21 17:46   ` Andy Shevchenko
2022-02-22  8:19     ` Clément Léger
2022-02-22  8:33       ` Andy Shevchenko
2022-02-22  8:46         ` Clément Léger
2022-02-22  9:24           ` Andy Shevchenko
2022-02-22  9:47             ` Clément Léger
2022-02-22 10:20               ` Greg Kroah-Hartman
2022-02-22 15:16                 ` Clément Léger
2022-02-21 16:26 ` [RFC 03/10] base: swnode: use fwnode_get_match_data() Clément Léger
2022-02-21 17:48   ` Andy Shevchenko
2022-02-22  8:39     ` Clément Léger
2022-02-23 15:05       ` Sakari Ailus
2022-02-23 15:15         ` Clément Léger
2022-02-23 15:21           ` Sakari Ailus
2022-02-21 16:26 ` [RFC 04/10] property: add a callback parameter to fwnode_property_match_string() Clément Léger
2022-02-21 17:51   ` Andy Shevchenko
2022-02-21 16:26 ` [RFC 05/10] property: add fwnode_property_read_string_index() Clément Léger
2022-02-21 16:26 ` [RFC 06/10] i2c: fwnode: add fwnode_find_i2c_adapter_by_node() Clément Léger
2022-02-21 18:00   ` Andy Shevchenko
2022-02-21 16:26 ` [RFC 07/10] i2c: of: use fwnode_get_i2c_adapter_by_node() Clément Léger
2022-02-21 16:26 ` [RFC 08/10] i2c: mux: pinctrl: remove CONFIG_OF dependency and use fwnode API Clément Léger
2022-02-21 16:26 ` [RFC 09/10] i2c: mux: add support for fwnode Clément Léger
2022-02-21 17:55   ` Andy Shevchenko
2022-02-22  8:53     ` Clément Léger
2022-02-22 10:57       ` Andrew Lunn
2022-02-22 20:31         ` Alexandre Belloni
2022-02-21 16:26 ` [RFC 10/10] net: sfp: " Clément Léger
2022-02-21 16:45   ` Russell King (Oracle)
2022-02-21 17:57   ` Andy Shevchenko
2022-02-22 13:25     ` Clément Léger
2022-02-23 11:22       ` Andy Shevchenko
2022-02-23 12:02         ` Hans de Goede
2022-02-23 12:31           ` Andrew Lunn
2022-02-23 12:41           ` Russell King (Oracle)
2022-02-23 13:39             ` Hans de Goede
2022-02-23 14:14               ` Clément Léger
2022-02-23 15:23                 ` Andrew Lunn
2022-02-23 15:27                   ` Hans de Goede
2022-02-23 15:27                   ` Hans de Goede
2022-02-23 15:36                     ` Andy Shevchenko
2022-02-23 15:38                   ` Clément Léger
2022-02-23 14:37             ` Andy Shevchenko
2022-02-21 21:48   ` kernel test robot [this message]
2022-02-21 17:41 ` [RFC 00/10] add support for fwnode in i2c mux system and sfp Andy Shevchenko
2022-02-22 16:30   ` Clément Léger
2022-02-23 14:46     ` Andy Shevchenko
2022-02-23 15:11       ` Clément Léger
2022-02-23 15:24         ` Andy Shevchenko
2022-02-23 17:41           ` Mark Brown
2022-02-23 17:59             ` Clément Léger
2022-02-23 18:12               ` Mark Brown
2022-02-23 18:19             ` Andy Shevchenko
2022-02-21 21:44 ` Andrew Lunn
2022-02-22  8:26   ` Andy Shevchenko
2022-02-22  8:57     ` Andrew Lunn
2022-02-22  9:20       ` Andy Shevchenko
2022-02-24 14:40 ` Clément Léger
2022-02-24 14:58   ` Hans de Goede
2022-02-24 15:33     ` Mark Brown
2022-02-24 18:14       ` Sakari Ailus
2022-02-24 18:39         ` Alexandre Belloni
2022-02-24 18:43           ` Mark Brown
2022-02-24 18:39         ` Mark Brown
2022-02-24 16:42     ` Clément Léger
2022-02-24 17:26       ` Mark Brown
2022-03-03  8:48         ` Clément Léger
2022-03-03 12:26           ` Mark Brown
2022-03-08 10:45   ` Clément Léger

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=202202220543.PIagZaL4-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=clement.leger@bootlin.com \
    --cc=kbuild-all@lists.01.org \
    --cc=llvm@lists.linux.dev \
    /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.