Re: [PATCH 3/3 v2] rtc: abx80x: Add support for autocalibration filter capacitor

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

 



Hi "Kevin,

Thank you for the patch! Perhaps something to improve:

url:    https://github.com/0day-ci/linux/commits/Kevin-P-Fleming/dt-bindings-abx80x-Add-autocal-filter-property/20200613-063944
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: i386-randconfig-m021-20200612 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

smatch warnings:
drivers/rtc/rtc-abx80x.c:821 abx80x_probe() error: uninitialized symbol 'trickle_cfg'.

# https://github.com/0day-ci/linux/commit/bbd3b3445f48810231c5f004a975116f19b37331
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout bbd3b3445f48810231c5f004a975116f19b37331
vim +/trickle_cfg +821 drivers/rtc/rtc-abx80x.c

4d61ff6b9960cb Philippe De Muyter 2015-05-05  700  static int abx80x_probe(struct i2c_client *client,
4d61ff6b9960cb Philippe De Muyter 2015-05-05  701  			const struct i2c_device_id *id)
4d61ff6b9960cb Philippe De Muyter 2015-05-05  702  {
4d61ff6b9960cb Philippe De Muyter 2015-05-05  703  	struct device_node *np = client->dev.of_node;
af69f9a7878413 Jeremy Gebben      2018-09-11  704  	struct abx80x_priv *priv;
bbd3b3445f4881 Kevin P. Fleming   2020-06-12  705  	int i, data, err, trickle_cfg, filter_cfg = -EINVAL;
                                                                          ^^^^^^^^^^^

4d61ff6b9960cb Philippe De Muyter 2015-05-05  706  	char buf[7];
4d61ff6b9960cb Philippe De Muyter 2015-05-05  707  	unsigned int part = id->driver_data;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  708  	unsigned int partnumber;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  709  	unsigned int majrev, minrev;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  710  	unsigned int lot;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  711  	unsigned int wafer;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  712  	unsigned int uid;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  713  
4d61ff6b9960cb Philippe De Muyter 2015-05-05  714  	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
4d61ff6b9960cb Philippe De Muyter 2015-05-05  715  		return -ENODEV;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  716  
4d61ff6b9960cb Philippe De Muyter 2015-05-05  717  	err = i2c_smbus_read_i2c_block_data(client, ABX8XX_REG_ID0,
4d61ff6b9960cb Philippe De Muyter 2015-05-05  718  					    sizeof(buf), buf);
4d61ff6b9960cb Philippe De Muyter 2015-05-05  719  	if (err < 0) {
4d61ff6b9960cb Philippe De Muyter 2015-05-05  720  		dev_err(&client->dev, "Unable to read partnumber\n");
4d61ff6b9960cb Philippe De Muyter 2015-05-05  721  		return -EIO;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  722  	}
4d61ff6b9960cb Philippe De Muyter 2015-05-05  723  
4d61ff6b9960cb Philippe De Muyter 2015-05-05  724  	partnumber = (buf[0] << 8) | buf[1];
4d61ff6b9960cb Philippe De Muyter 2015-05-05  725  	majrev = buf[2] >> 3;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  726  	minrev = buf[2] & 0x7;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  727  	lot = ((buf[4] & 0x80) << 2) | ((buf[6] & 0x80) << 1) | buf[3];
4d61ff6b9960cb Philippe De Muyter 2015-05-05  728  	uid = ((buf[4] & 0x7f) << 8) | buf[5];
4d61ff6b9960cb Philippe De Muyter 2015-05-05  729  	wafer = (buf[6] & 0x7c) >> 2;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  730  	dev_info(&client->dev, "model %04x, revision %u.%u, lot %x, wafer %x, uid %x\n",
4d61ff6b9960cb Philippe De Muyter 2015-05-05  731  		 partnumber, majrev, minrev, lot, wafer, uid);
4d61ff6b9960cb Philippe De Muyter 2015-05-05  732  
4d61ff6b9960cb Philippe De Muyter 2015-05-05  733  	data = i2c_smbus_read_byte_data(client, ABX8XX_REG_CTRL1);
4d61ff6b9960cb Philippe De Muyter 2015-05-05  734  	if (data < 0) {
4d61ff6b9960cb Philippe De Muyter 2015-05-05  735  		dev_err(&client->dev, "Unable to read control register\n");
4d61ff6b9960cb Philippe De Muyter 2015-05-05  736  		return -EIO;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  737  	}
4d61ff6b9960cb Philippe De Muyter 2015-05-05  738  
4d61ff6b9960cb Philippe De Muyter 2015-05-05  739  	err = i2c_smbus_write_byte_data(client, ABX8XX_REG_CTRL1,
718a820a303ca6 Alexandre Belloni  2015-12-17  740  					((data & ~(ABX8XX_CTRL_12_24 |
718a820a303ca6 Alexandre Belloni  2015-12-17  741  						   ABX8XX_CTRL_ARST)) |
4d61ff6b9960cb Philippe De Muyter 2015-05-05  742  					 ABX8XX_CTRL_WRITE));
4d61ff6b9960cb Philippe De Muyter 2015-05-05  743  	if (err < 0) {
4d61ff6b9960cb Philippe De Muyter 2015-05-05  744  		dev_err(&client->dev, "Unable to write control register\n");
4d61ff6b9960cb Philippe De Muyter 2015-05-05  745  		return -EIO;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  746  	}
4d61ff6b9960cb Philippe De Muyter 2015-05-05  747  
75455e258ea2b3 Marek Vasut        2019-01-29  748  	/* Configure RV1805 specifics */
75455e258ea2b3 Marek Vasut        2019-01-29  749  	if (part == RV1805) {
75455e258ea2b3 Marek Vasut        2019-01-29  750  		/*
75455e258ea2b3 Marek Vasut        2019-01-29  751  		 * Avoid accidentally entering test mode. This can happen
75455e258ea2b3 Marek Vasut        2019-01-29  752  		 * on the RV1805 in case the reserved bit 5 in control2
75455e258ea2b3 Marek Vasut        2019-01-29  753  		 * register is set. RV-1805-C3 datasheet indicates that
75455e258ea2b3 Marek Vasut        2019-01-29  754  		 * the bit should be cleared in section 11h - Control2.
75455e258ea2b3 Marek Vasut        2019-01-29  755  		 */
75455e258ea2b3 Marek Vasut        2019-01-29  756  		data = i2c_smbus_read_byte_data(client, ABX8XX_REG_CTRL2);
75455e258ea2b3 Marek Vasut        2019-01-29  757  		if (data < 0) {
75455e258ea2b3 Marek Vasut        2019-01-29  758  			dev_err(&client->dev,
75455e258ea2b3 Marek Vasut        2019-01-29  759  				"Unable to read control2 register\n");
75455e258ea2b3 Marek Vasut        2019-01-29  760  			return -EIO;
75455e258ea2b3 Marek Vasut        2019-01-29  761  		}
75455e258ea2b3 Marek Vasut        2019-01-29  762  
75455e258ea2b3 Marek Vasut        2019-01-29  763  		err = i2c_smbus_write_byte_data(client, ABX8XX_REG_CTRL2,
75455e258ea2b3 Marek Vasut        2019-01-29  764  						data & ~ABX8XX_CTRL2_RSVD);
75455e258ea2b3 Marek Vasut        2019-01-29  765  		if (err < 0) {
75455e258ea2b3 Marek Vasut        2019-01-29  766  			dev_err(&client->dev,
75455e258ea2b3 Marek Vasut        2019-01-29  767  				"Unable to write control2 register\n");
75455e258ea2b3 Marek Vasut        2019-01-29  768  			return -EIO;
75455e258ea2b3 Marek Vasut        2019-01-29  769  		}
75455e258ea2b3 Marek Vasut        2019-01-29  770  
75455e258ea2b3 Marek Vasut        2019-01-29  771  		/*
75455e258ea2b3 Marek Vasut        2019-01-29  772  		 * Avoid extra power leakage. The RV1805 uses smaller
75455e258ea2b3 Marek Vasut        2019-01-29  773  		 * 10pin package and the EXTI input is not present.
75455e258ea2b3 Marek Vasut        2019-01-29  774  		 * Disable it to avoid leakage.
75455e258ea2b3 Marek Vasut        2019-01-29  775  		 */
75455e258ea2b3 Marek Vasut        2019-01-29  776  		data = i2c_smbus_read_byte_data(client, ABX8XX_REG_OUT_CTRL);
75455e258ea2b3 Marek Vasut        2019-01-29  777  		if (data < 0) {
75455e258ea2b3 Marek Vasut        2019-01-29  778  			dev_err(&client->dev,
75455e258ea2b3 Marek Vasut        2019-01-29  779  				"Unable to read output control register\n");
75455e258ea2b3 Marek Vasut        2019-01-29  780  			return -EIO;
75455e258ea2b3 Marek Vasut        2019-01-29  781  		}
75455e258ea2b3 Marek Vasut        2019-01-29  782  
75455e258ea2b3 Marek Vasut        2019-01-29  783  		/*
75455e258ea2b3 Marek Vasut        2019-01-29  784  		 * Write the configuration key register to enable access to
75455e258ea2b3 Marek Vasut        2019-01-29  785  		 * the config2 register
75455e258ea2b3 Marek Vasut        2019-01-29  786  		 */
fee83bca1a1fde Kevin P. Fleming   2020-06-12  787  		if (abx80x_write_config_key(client, ABX8XX_CFG_KEY_MISC) < 0)
75455e258ea2b3 Marek Vasut        2019-01-29  788  			return -EIO;
75455e258ea2b3 Marek Vasut        2019-01-29  789  
75455e258ea2b3 Marek Vasut        2019-01-29  790  		err = i2c_smbus_write_byte_data(client, ABX8XX_REG_OUT_CTRL,
75455e258ea2b3 Marek Vasut        2019-01-29  791  						data | ABX8XX_OUT_CTRL_EXDS);
75455e258ea2b3 Marek Vasut        2019-01-29  792  		if (err < 0) {
75455e258ea2b3 Marek Vasut        2019-01-29  793  			dev_err(&client->dev,
75455e258ea2b3 Marek Vasut        2019-01-29  794  				"Unable to write output control register\n");
75455e258ea2b3 Marek Vasut        2019-01-29  795  			return -EIO;
75455e258ea2b3 Marek Vasut        2019-01-29  796  		}
75455e258ea2b3 Marek Vasut        2019-01-29  797  	}
75455e258ea2b3 Marek Vasut        2019-01-29  798  
4d61ff6b9960cb Philippe De Muyter 2015-05-05  799  	/* part autodetection */
4d61ff6b9960cb Philippe De Muyter 2015-05-05  800  	if (part == ABX80X) {
4d61ff6b9960cb Philippe De Muyter 2015-05-05  801  		for (i = 0; abx80x_caps[i].pn; i++)
4d61ff6b9960cb Philippe De Muyter 2015-05-05  802  			if (partnumber == abx80x_caps[i].pn)
4d61ff6b9960cb Philippe De Muyter 2015-05-05  803  				break;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  804  		if (abx80x_caps[i].pn == 0) {
4d61ff6b9960cb Philippe De Muyter 2015-05-05  805  			dev_err(&client->dev, "Unknown part: %04x\n",
4d61ff6b9960cb Philippe De Muyter 2015-05-05  806  				partnumber);
4d61ff6b9960cb Philippe De Muyter 2015-05-05  807  			return -EINVAL;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  808  		}
4d61ff6b9960cb Philippe De Muyter 2015-05-05  809  		part = i;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  810  	}
4d61ff6b9960cb Philippe De Muyter 2015-05-05  811  
4d61ff6b9960cb Philippe De Muyter 2015-05-05  812  	if (partnumber != abx80x_caps[part].pn) {
4d61ff6b9960cb Philippe De Muyter 2015-05-05  813  		dev_err(&client->dev, "partnumber mismatch %04x != %04x\n",
4d61ff6b9960cb Philippe De Muyter 2015-05-05  814  			partnumber, abx80x_caps[part].pn);
4d61ff6b9960cb Philippe De Muyter 2015-05-05  815  		return -EINVAL;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  816  	}
4d61ff6b9960cb Philippe De Muyter 2015-05-05  817  
4d61ff6b9960cb Philippe De Muyter 2015-05-05  818  	if (np && abx80x_caps[part].has_tc)
6e429f6b8c6b8f Kevin P. Fleming   2020-05-30  819  		trickle_cfg = abx80x_dt_trickle_cfg(client);
                                                                ^^^^^^^^^^^^^
Not initialized on else path.

4d61ff6b9960cb Philippe De Muyter 2015-05-05  820  
4d61ff6b9960cb Philippe De Muyter 2015-05-05 @821  	if (trickle_cfg > 0) {
                                                            ^^^^^^^^^^^

4d61ff6b9960cb Philippe De Muyter 2015-05-05  822  		dev_info(&client->dev, "Enabling trickle charger: %02x\n",
4d61ff6b9960cb Philippe De Muyter 2015-05-05  823  			 trickle_cfg);
4d61ff6b9960cb Philippe De Muyter 2015-05-05  824  		abx80x_enable_trickle_charger(client, trickle_cfg);
4d61ff6b9960cb Philippe De Muyter 2015-05-05  825  	}
4d61ff6b9960cb Philippe De Muyter 2015-05-05  826  
718a820a303ca6 Alexandre Belloni  2015-12-17  827  	err = i2c_smbus_write_byte_data(client, ABX8XX_REG_CD_TIMER_CTL,
718a820a303ca6 Alexandre Belloni  2015-12-17  828  					BIT(2));
718a820a303ca6 Alexandre Belloni  2015-12-17  829  	if (err)
718a820a303ca6 Alexandre Belloni  2015-12-17  830  		return err;
718a820a303ca6 Alexandre Belloni  2015-12-17  831  
af69f9a7878413 Jeremy Gebben      2018-09-11  832  	priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
af69f9a7878413 Jeremy Gebben      2018-09-11  833  	if (priv == NULL)
af69f9a7878413 Jeremy Gebben      2018-09-11  834  		return -ENOMEM;
af69f9a7878413 Jeremy Gebben      2018-09-11  835  
af69f9a7878413 Jeremy Gebben      2018-09-11  836  	priv->rtc = devm_rtc_allocate_device(&client->dev);
af69f9a7878413 Jeremy Gebben      2018-09-11  837  	if (IS_ERR(priv->rtc))
af69f9a7878413 Jeremy Gebben      2018-09-11  838  		return PTR_ERR(priv->rtc);
4d61ff6b9960cb Philippe De Muyter 2015-05-05  839  
af69f9a7878413 Jeremy Gebben      2018-09-11  840  	priv->rtc->ops = &abx80x_rtc_ops;
af69f9a7878413 Jeremy Gebben      2018-09-11  841  	priv->client = client;
9360a6a81862d3 Alexandre Belloni  2017-10-13  842  
af69f9a7878413 Jeremy Gebben      2018-09-11  843  	i2c_set_clientdata(client, priv);
4d61ff6b9960cb Philippe De Muyter 2015-05-05  844  
749e36d0a0d725 Jeremy Gebben      2018-09-11  845  	if (abx80x_caps[part].has_wdog) {
749e36d0a0d725 Jeremy Gebben      2018-09-11  846  		err = abx80x_setup_watchdog(priv);
749e36d0a0d725 Jeremy Gebben      2018-09-11  847  		if (err)
749e36d0a0d725 Jeremy Gebben      2018-09-11  848  			return err;
749e36d0a0d725 Jeremy Gebben      2018-09-11  849  	}
749e36d0a0d725 Jeremy Gebben      2018-09-11  850  
bbd3b3445f4881 Kevin P. Fleming   2020-06-12  851  	if (of_property_read_u32(np, "abracon,autocal_filter", &filter_cfg) == 0) {
bbd3b3445f4881 Kevin P. Fleming   2020-06-12  852  		err = abx80x_set_autocal_filter(client,
bbd3b3445f4881 Kevin P. Fleming   2020-06-12  853  						filter_cfg ?
bbd3b3445f4881 Kevin P. Fleming   2020-06-12  854  						ABX8XX_AUTOCAL_FILTER_ENABLE :
bbd3b3445f4881 Kevin P. Fleming   2020-06-12  855  						ABX8XX_AUTOCAL_FILTER_DISABLE);
bbd3b3445f4881 Kevin P. Fleming   2020-06-12  856  		if (err)
bbd3b3445f4881 Kevin P. Fleming   2020-06-12  857  			return err;
bbd3b3445f4881 Kevin P. Fleming   2020-06-12  858  	}
bbd3b3445f4881 Kevin P. Fleming   2020-06-12  859  
718a820a303ca6 Alexandre Belloni  2015-12-17  860  	if (client->irq > 0) {
718a820a303ca6 Alexandre Belloni  2015-12-17  861  		dev_info(&client->dev, "IRQ %d supplied\n", client->irq);
718a820a303ca6 Alexandre Belloni  2015-12-17  862  		err = devm_request_threaded_irq(&client->dev, client->irq, NULL,
718a820a303ca6 Alexandre Belloni  2015-12-17  863  						abx80x_handle_irq,
718a820a303ca6 Alexandre Belloni  2015-12-17  864  						IRQF_SHARED | IRQF_ONESHOT,
718a820a303ca6 Alexandre Belloni  2015-12-17  865  						"abx8xx",
718a820a303ca6 Alexandre Belloni  2015-12-17  866  						client);
718a820a303ca6 Alexandre Belloni  2015-12-17  867  		if (err) {
718a820a303ca6 Alexandre Belloni  2015-12-17  868  			dev_err(&client->dev, "unable to request IRQ, alarms disabled\n");
718a820a303ca6 Alexandre Belloni  2015-12-17  869  			client->irq = 0;
718a820a303ca6 Alexandre Belloni  2015-12-17  870  		}
718a820a303ca6 Alexandre Belloni  2015-12-17  871  	}
718a820a303ca6 Alexandre Belloni  2015-12-17  872  
559e883e0f7768 Alexandre Belloni  2019-03-06  873  	err = rtc_add_group(priv->rtc, &rtc_calib_attr_group);
59a8383adb7545 Mylène Josserand   2016-03-21  874  	if (err) {
59a8383adb7545 Mylène Josserand   2016-03-21  875  		dev_err(&client->dev, "Failed to create sysfs group: %d\n",
59a8383adb7545 Mylène Josserand   2016-03-21  876  			err);
59a8383adb7545 Mylène Josserand   2016-03-21  877  		return err;
59a8383adb7545 Mylène Josserand   2016-03-21  878  	}
59a8383adb7545 Mylène Josserand   2016-03-21  879  
559e883e0f7768 Alexandre Belloni  2019-03-06  880  	return rtc_register_device(priv->rtc);
4d61ff6b9960cb Philippe De Muyter 2015-05-05  881  }

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux