Content-Type: multipart/mixed; boundary="===============2699418015627733807==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: Re: [PATCH 4/4] i2c-mux-pca954x: Add regulator support Date: Tue, 14 Dec 2021 21:12:27 +0800 Message-ID: <202112142101.s4i5cHhd-lkp@intel.com> In-Reply-To: <20211214095021.572799-4-patrick.rudolph@9elements.com> List-Id: --===============2699418015627733807== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Patrick, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on wsa/i2c/for-next] [also build test WARNING on robh/for-next linux/master linus/master v5.16-r= c5] [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/Patrick-Rudolph/dt-binding= s-i2c-Update-PCA954x/20211214-175258 base: https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/f= or-next config: riscv-randconfig-r042-20211214 (https://download.01.org/0day-ci/arc= hive/20211214/202112142101.s4i5cHhd-lkp(a)intel.com/config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project b6a2dd= b6c8ac29412b1361810972e15221fa021c) reproduce (this is a W=3D1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/= make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install riscv cross compiling tool for clang build # apt-get install binutils-riscv64-linux-gnu # https://github.com/0day-ci/linux/commit/3498c52eb6aec09c78a3f07cd= cb042897960f8ef git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Patrick-Rudolph/dt-bindings-i2c-Up= date-PCA954x/20211214-175258 git checkout 3498c52eb6aec09c78a3f07cdcb042897960f8ef # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dclang make.cross W=3D= 1 O=3Dbuild_dir ARCH=3Driscv SHELL=3D/bin/bash drivers/i2c/muxes/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): >> drivers/i2c/muxes/i2c-mux-pca954x.c:502:58: warning: variable 'ret' is u= ninitialized when used here [-Wuninitialized] dev_warn(dev, "Failed to get regulator for vcc: %d\n", r= et); ^= ~~ include/linux/dev_printk.h:146:70: note: expanded from macro 'dev_warn' dev_printk_index_wrap(_dev_warn, KERN_WARNING, dev, dev_fmt(fmt)= , ##__VA_ARGS__) = ^~~~~~~~~~~ include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk= _index_wrap' _p_func(dev, fmt, ##__VA_ARGS__); \ ^~~~~~~~~~~ drivers/i2c/muxes/i2c-mux-pca954x.c:483:9: note: initialize the variable= 'ret' to silence this warning int ret; ^ =3D 0 1 warning generated. vim +/ret +502 drivers/i2c/muxes/i2c-mux-pca954x.c 470 = 471 /* 472 * I2C init/probing/exit functions 473 */ 474 static int pca954x_probe(struct i2c_client *client, 475 const struct i2c_device_id *id) 476 { 477 struct i2c_adapter *adap =3D client->adapter; 478 struct device *dev =3D &client->dev; 479 struct gpio_desc *gpio; 480 struct i2c_mux_core *muxc; 481 struct pca954x *data; 482 int num; 483 int ret; 484 = 485 if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE)) 486 return -ENODEV; 487 = 488 muxc =3D i2c_mux_alloc(adap, dev, PCA954X_MAX_NCHANS, sizeof(*data)= , 0, 489 pca954x_select_chan, pca954x_deselect_mux); 490 if (!muxc) 491 return -ENOMEM; 492 = 493 data =3D i2c_mux_priv(muxc); 494 = 495 i2c_set_clientdata(client, muxc); 496 data->client =3D client; 497 = 498 data->supply =3D devm_regulator_get(dev, "vcc"); 499 if (IS_ERR(data->supply)) { 500 if ((PTR_ERR(data->supply) =3D=3D -EPROBE_DEFER)) 501 return -EPROBE_DEFER; > 502 dev_warn(dev, "Failed to get regulator for vcc: %d\n", ret); 503 } else { 504 ret =3D regulator_enable(data->supply); 505 if (ret) { 506 dev_err(dev, "Failed to enable regulator vcc\n"); 507 return ret; 508 } 509 } 510 = 511 /* Reset the mux if a reset GPIO is specified. */ 512 gpio =3D devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); 513 if (IS_ERR(gpio)) { 514 ret =3D PTR_ERR(gpio); 515 goto fail_cleanup; 516 } 517 if (gpio) { 518 udelay(1); 519 gpiod_set_value_cansleep(gpio, 0); 520 /* Give the chip some time to recover. */ 521 udelay(1); 522 } 523 = 524 data->chip =3D device_get_match_data(dev); 525 if (!data->chip) 526 data->chip =3D &chips[id->driver_data]; 527 = 528 if (data->chip->id.manufacturer_id !=3D I2C_DEVICE_ID_NONE) { 529 struct i2c_device_identity id; 530 = 531 ret =3D i2c_get_device_id(client, &id); 532 if (ret && ret !=3D -EOPNOTSUPP) 533 goto fail_cleanup; 534 = 535 if (!ret && 536 (id.manufacturer_id !=3D data->chip->id.manufacturer_id || 537 id.part_id !=3D data->chip->id.part_id)) { 538 dev_warn(dev, "unexpected device id %03x-%03x-%x\n", 539 id.manufacturer_id, id.part_id, 540 id.die_revision); 541 ret =3D -ENODEV; 542 goto fail_cleanup; 543 } 544 } 545 = 546 data->idle_state =3D MUX_IDLE_AS_IS; 547 if (device_property_read_u32(dev, "idle-state", &data->idle_state))= { 548 if (device_property_read_bool(dev, "i2c-mux-idle-disconnect")) 549 data->idle_state =3D MUX_IDLE_DISCONNECT; 550 } 551 = 552 /* 553 * Write the mux register at addr to verify 554 * that the mux is in fact present. This also 555 * initializes the mux to a channel 556 * or disconnected state. 557 */ 558 ret =3D pca954x_init(client, data); 559 if (ret < 0) { 560 dev_warn(dev, "probe failed\n"); 561 ret =3D -ENODEV; 562 goto fail_cleanup; 563 } 564 = 565 ret =3D pca954x_irq_setup(muxc); 566 if (ret) 567 goto fail_cleanup; 568 = 569 /* Now create an adapter for each channel */ 570 for (num =3D 0; num < data->chip->nchans; num++) { 571 ret =3D i2c_mux_add_adapter(muxc, 0, num, 0); 572 if (ret) 573 goto fail_cleanup; 574 } 575 = 576 if (data->irq) { 577 ret =3D devm_request_threaded_irq(dev, data->client->irq, 578 NULL, pca954x_irq_handler, 579 IRQF_ONESHOT | IRQF_SHARED, 580 "pca954x", data); 581 if (ret) 582 goto fail_cleanup; 583 } 584 = 585 /* 586 * The attr probably isn't going to be needed in most cases, 587 * so don't fail completely on error. 588 */ 589 device_create_file(dev, &dev_attr_idle_state); 590 = 591 dev_info(dev, "registered %d multiplexed busses for I2C %s %s\n", 592 num, data->chip->muxtype =3D=3D pca954x_ismux 593 ? "mux" : "switch", client->name); 594 = 595 return 0; 596 = 597 fail_cleanup: 598 pca954x_cleanup(muxc); 599 return ret; 600 } 601 = --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============2699418015627733807==--