All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org,
	Kirill Kapranov <kirill.kapranov@compulab.co.il>,
	a.zummo@towertech.it, alexandre.belloni@bootlin.com,
	phdm@macqel.be, linux-rtc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	Kirill Kapranov <kirill.kapranov@compulab.co.il>
Subject: Re: [PATCH 2/4] rtc: abx80x: Enable SQW output
Date: Mon, 29 Mar 2021 09:19:56 +0300	[thread overview]
Message-ID: <20210329061956.GJ1717@kadam> (raw)
In-Reply-To: <20210328210232.10395-3-kirill.kapranov@compulab.co.il>

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

Hi Kirill,

url:    https://github.com/0day-ci/linux/commits/Kirill-Kapranov/rtc-abx80x-Enable-distributed-digital-calibration/20210329-053233
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: i386-randconfig-m021-20210328 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

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

smatch warnings:
drivers/rtc/rtc-abx80x.c:561 sqw_set() error: uninitialized symbol 'retval'.

vim +/retval +561 drivers/rtc/rtc-abx80x.c

3f6d456de4f347 Kirill Kapranov 2021-03-29  527  static int sqw_set(struct i2c_client *client, const char *buf)
3f6d456de4f347 Kirill Kapranov 2021-03-29  528  {
3f6d456de4f347 Kirill Kapranov 2021-03-29  529  	union abx8xx_reg_sqw reg_sqw;
3f6d456de4f347 Kirill Kapranov 2021-03-29  530  	int retval;
3f6d456de4f347 Kirill Kapranov 2021-03-29  531  
3f6d456de4f347 Kirill Kapranov 2021-03-29  532  	reg_sqw.val = i2c_smbus_read_byte_data(client, ABX8XX_REG_SQW);
3f6d456de4f347 Kirill Kapranov 2021-03-29  533  	if (reg_sqw.val < 0)
3f6d456de4f347 Kirill Kapranov 2021-03-29  534  		goto err;

"retval" not set.  Forgetting to set the error code is the canonical
bug for do nothing gotos like this.

3f6d456de4f347 Kirill Kapranov 2021-03-29  535  
3f6d456de4f347 Kirill Kapranov 2021-03-29  536  	if (sysfs_streq(buf, "none")) {
3f6d456de4f347 Kirill Kapranov 2021-03-29  537  		reg_sqw.sqwe = 0;
3f6d456de4f347 Kirill Kapranov 2021-03-29  538  		dev_info(&client->dev, "sqw output disabled\n");
3f6d456de4f347 Kirill Kapranov 2021-03-29  539  	} else {
3f6d456de4f347 Kirill Kapranov 2021-03-29  540  		int idx = __sysfs_match_string(sqfs, SQFS_COUNT, buf);
3f6d456de4f347 Kirill Kapranov 2021-03-29  541  
3f6d456de4f347 Kirill Kapranov 2021-03-29  542  		if (idx < 0)
3f6d456de4f347 Kirill Kapranov 2021-03-29  543  			return idx;
                                                                        ^^^^^^^^^^^
These are direct returns.  Just do direct returns everywhere (more
readably, fewer bugs).

3f6d456de4f347 Kirill Kapranov 2021-03-29  544  
3f6d456de4f347 Kirill Kapranov 2021-03-29  545  		if (abx80x_is_rc_mode(client) && !valid_for_rc_mode[idx])
3f6d456de4f347 Kirill Kapranov 2021-03-29  546  			dev_warn(&client->dev, "sqw frequency %s valid only in xt mode\n",
3f6d456de4f347 Kirill Kapranov 2021-03-29  547  				sqfs[idx]);
3f6d456de4f347 Kirill Kapranov 2021-03-29  548  
3f6d456de4f347 Kirill Kapranov 2021-03-29  549  		dev_info(&client->dev, "sqw output enabled @ %s\n", sqfs[idx]);
3f6d456de4f347 Kirill Kapranov 2021-03-29  550  		reg_sqw.sqwe = 1;
3f6d456de4f347 Kirill Kapranov 2021-03-29  551  		reg_sqw.sqws = idx;
3f6d456de4f347 Kirill Kapranov 2021-03-29  552  	}
3f6d456de4f347 Kirill Kapranov 2021-03-29  553  
3f6d456de4f347 Kirill Kapranov 2021-03-29  554  	retval = i2c_smbus_write_byte_data(client, ABX8XX_REG_SQW, reg_sqw.val);
3f6d456de4f347 Kirill Kapranov 2021-03-29  555  	if (retval < 0)
3f6d456de4f347 Kirill Kapranov 2021-03-29  556  		goto err;
3f6d456de4f347 Kirill Kapranov 2021-03-29  557  
3f6d456de4f347 Kirill Kapranov 2021-03-29  558  	return 0;
3f6d456de4f347 Kirill Kapranov 2021-03-29  559  err:
3f6d456de4f347 Kirill Kapranov 2021-03-29  560  	dev_err(&client->dev, "Failed to set SQW\n");
3f6d456de4f347 Kirill Kapranov 2021-03-29 @561  	return retval;
                                                        ^^^^^^^^^^^^^

3f6d456de4f347 Kirill Kapranov 2021-03-29  562  

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

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

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH 2/4] rtc: abx80x: Enable SQW output
Date: Mon, 29 Mar 2021 09:19:56 +0300	[thread overview]
Message-ID: <20210329061956.GJ1717@kadam> (raw)
In-Reply-To: <20210328210232.10395-3-kirill.kapranov@compulab.co.il>

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

Hi Kirill,

url:    https://github.com/0day-ci/linux/commits/Kirill-Kapranov/rtc-abx80x-Enable-distributed-digital-calibration/20210329-053233
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: i386-randconfig-m021-20210328 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

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

smatch warnings:
drivers/rtc/rtc-abx80x.c:561 sqw_set() error: uninitialized symbol 'retval'.

vim +/retval +561 drivers/rtc/rtc-abx80x.c

3f6d456de4f347 Kirill Kapranov 2021-03-29  527  static int sqw_set(struct i2c_client *client, const char *buf)
3f6d456de4f347 Kirill Kapranov 2021-03-29  528  {
3f6d456de4f347 Kirill Kapranov 2021-03-29  529  	union abx8xx_reg_sqw reg_sqw;
3f6d456de4f347 Kirill Kapranov 2021-03-29  530  	int retval;
3f6d456de4f347 Kirill Kapranov 2021-03-29  531  
3f6d456de4f347 Kirill Kapranov 2021-03-29  532  	reg_sqw.val = i2c_smbus_read_byte_data(client, ABX8XX_REG_SQW);
3f6d456de4f347 Kirill Kapranov 2021-03-29  533  	if (reg_sqw.val < 0)
3f6d456de4f347 Kirill Kapranov 2021-03-29  534  		goto err;

"retval" not set.  Forgetting to set the error code is the canonical
bug for do nothing gotos like this.

3f6d456de4f347 Kirill Kapranov 2021-03-29  535  
3f6d456de4f347 Kirill Kapranov 2021-03-29  536  	if (sysfs_streq(buf, "none")) {
3f6d456de4f347 Kirill Kapranov 2021-03-29  537  		reg_sqw.sqwe = 0;
3f6d456de4f347 Kirill Kapranov 2021-03-29  538  		dev_info(&client->dev, "sqw output disabled\n");
3f6d456de4f347 Kirill Kapranov 2021-03-29  539  	} else {
3f6d456de4f347 Kirill Kapranov 2021-03-29  540  		int idx = __sysfs_match_string(sqfs, SQFS_COUNT, buf);
3f6d456de4f347 Kirill Kapranov 2021-03-29  541  
3f6d456de4f347 Kirill Kapranov 2021-03-29  542  		if (idx < 0)
3f6d456de4f347 Kirill Kapranov 2021-03-29  543  			return idx;
                                                                        ^^^^^^^^^^^
These are direct returns.  Just do direct returns everywhere (more
readably, fewer bugs).

3f6d456de4f347 Kirill Kapranov 2021-03-29  544  
3f6d456de4f347 Kirill Kapranov 2021-03-29  545  		if (abx80x_is_rc_mode(client) && !valid_for_rc_mode[idx])
3f6d456de4f347 Kirill Kapranov 2021-03-29  546  			dev_warn(&client->dev, "sqw frequency %s valid only in xt mode\n",
3f6d456de4f347 Kirill Kapranov 2021-03-29  547  				sqfs[idx]);
3f6d456de4f347 Kirill Kapranov 2021-03-29  548  
3f6d456de4f347 Kirill Kapranov 2021-03-29  549  		dev_info(&client->dev, "sqw output enabled @ %s\n", sqfs[idx]);
3f6d456de4f347 Kirill Kapranov 2021-03-29  550  		reg_sqw.sqwe = 1;
3f6d456de4f347 Kirill Kapranov 2021-03-29  551  		reg_sqw.sqws = idx;
3f6d456de4f347 Kirill Kapranov 2021-03-29  552  	}
3f6d456de4f347 Kirill Kapranov 2021-03-29  553  
3f6d456de4f347 Kirill Kapranov 2021-03-29  554  	retval = i2c_smbus_write_byte_data(client, ABX8XX_REG_SQW, reg_sqw.val);
3f6d456de4f347 Kirill Kapranov 2021-03-29  555  	if (retval < 0)
3f6d456de4f347 Kirill Kapranov 2021-03-29  556  		goto err;
3f6d456de4f347 Kirill Kapranov 2021-03-29  557  
3f6d456de4f347 Kirill Kapranov 2021-03-29  558  	return 0;
3f6d456de4f347 Kirill Kapranov 2021-03-29  559  err:
3f6d456de4f347 Kirill Kapranov 2021-03-29  560  	dev_err(&client->dev, "Failed to set SQW\n");
3f6d456de4f347 Kirill Kapranov 2021-03-29 @561  	return retval;
                                                        ^^^^^^^^^^^^^

3f6d456de4f347 Kirill Kapranov 2021-03-29  562  

---
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: 35066 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH 2/4] rtc: abx80x: Enable SQW output
Date: Mon, 29 Mar 2021 09:19:56 +0300	[thread overview]
Message-ID: <20210329061956.GJ1717@kadam> (raw)
In-Reply-To: <20210328210232.10395-3-kirill.kapranov@compulab.co.il>

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

Hi Kirill,

url:    https://github.com/0day-ci/linux/commits/Kirill-Kapranov/rtc-abx80x-Enable-distributed-digital-calibration/20210329-053233
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: i386-randconfig-m021-20210328 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

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

smatch warnings:
drivers/rtc/rtc-abx80x.c:561 sqw_set() error: uninitialized symbol 'retval'.

vim +/retval +561 drivers/rtc/rtc-abx80x.c

3f6d456de4f347 Kirill Kapranov 2021-03-29  527  static int sqw_set(struct i2c_client *client, const char *buf)
3f6d456de4f347 Kirill Kapranov 2021-03-29  528  {
3f6d456de4f347 Kirill Kapranov 2021-03-29  529  	union abx8xx_reg_sqw reg_sqw;
3f6d456de4f347 Kirill Kapranov 2021-03-29  530  	int retval;
3f6d456de4f347 Kirill Kapranov 2021-03-29  531  
3f6d456de4f347 Kirill Kapranov 2021-03-29  532  	reg_sqw.val = i2c_smbus_read_byte_data(client, ABX8XX_REG_SQW);
3f6d456de4f347 Kirill Kapranov 2021-03-29  533  	if (reg_sqw.val < 0)
3f6d456de4f347 Kirill Kapranov 2021-03-29  534  		goto err;

"retval" not set.  Forgetting to set the error code is the canonical
bug for do nothing gotos like this.

3f6d456de4f347 Kirill Kapranov 2021-03-29  535  
3f6d456de4f347 Kirill Kapranov 2021-03-29  536  	if (sysfs_streq(buf, "none")) {
3f6d456de4f347 Kirill Kapranov 2021-03-29  537  		reg_sqw.sqwe = 0;
3f6d456de4f347 Kirill Kapranov 2021-03-29  538  		dev_info(&client->dev, "sqw output disabled\n");
3f6d456de4f347 Kirill Kapranov 2021-03-29  539  	} else {
3f6d456de4f347 Kirill Kapranov 2021-03-29  540  		int idx = __sysfs_match_string(sqfs, SQFS_COUNT, buf);
3f6d456de4f347 Kirill Kapranov 2021-03-29  541  
3f6d456de4f347 Kirill Kapranov 2021-03-29  542  		if (idx < 0)
3f6d456de4f347 Kirill Kapranov 2021-03-29  543  			return idx;
                                                                        ^^^^^^^^^^^
These are direct returns.  Just do direct returns everywhere (more
readably, fewer bugs).

3f6d456de4f347 Kirill Kapranov 2021-03-29  544  
3f6d456de4f347 Kirill Kapranov 2021-03-29  545  		if (abx80x_is_rc_mode(client) && !valid_for_rc_mode[idx])
3f6d456de4f347 Kirill Kapranov 2021-03-29  546  			dev_warn(&client->dev, "sqw frequency %s valid only in xt mode\n",
3f6d456de4f347 Kirill Kapranov 2021-03-29  547  				sqfs[idx]);
3f6d456de4f347 Kirill Kapranov 2021-03-29  548  
3f6d456de4f347 Kirill Kapranov 2021-03-29  549  		dev_info(&client->dev, "sqw output enabled @ %s\n", sqfs[idx]);
3f6d456de4f347 Kirill Kapranov 2021-03-29  550  		reg_sqw.sqwe = 1;
3f6d456de4f347 Kirill Kapranov 2021-03-29  551  		reg_sqw.sqws = idx;
3f6d456de4f347 Kirill Kapranov 2021-03-29  552  	}
3f6d456de4f347 Kirill Kapranov 2021-03-29  553  
3f6d456de4f347 Kirill Kapranov 2021-03-29  554  	retval = i2c_smbus_write_byte_data(client, ABX8XX_REG_SQW, reg_sqw.val);
3f6d456de4f347 Kirill Kapranov 2021-03-29  555  	if (retval < 0)
3f6d456de4f347 Kirill Kapranov 2021-03-29  556  		goto err;
3f6d456de4f347 Kirill Kapranov 2021-03-29  557  
3f6d456de4f347 Kirill Kapranov 2021-03-29  558  	return 0;
3f6d456de4f347 Kirill Kapranov 2021-03-29  559  err:
3f6d456de4f347 Kirill Kapranov 2021-03-29  560  	dev_err(&client->dev, "Failed to set SQW\n");
3f6d456de4f347 Kirill Kapranov 2021-03-29 @561  	return retval;
                                                        ^^^^^^^^^^^^^

3f6d456de4f347 Kirill Kapranov 2021-03-29  562  

---
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: 35066 bytes --]

  parent reply	other threads:[~2021-03-29  6:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-28 21:02 [PATCH 0/4] rtc:abx80x: Enable distributed digital calibration Kirill Kapranov
2021-03-28 21:02 ` [PATCH 1/4] dt-bindings: rtc: abracon,abx80x: Add sqw property Kirill Kapranov
2021-03-28 21:02 ` [PATCH 2/4] rtc: abx80x: Enable SQW output Kirill Kapranov
2021-03-29  0:34   ` kernel test robot
2021-03-29  0:34     ` kernel test robot
2021-03-29  6:19   ` Dan Carpenter [this message]
2021-03-29  6:19     ` Dan Carpenter
2021-03-29  6:19     ` Dan Carpenter
2021-03-30 15:28     ` Kirill Kapranov
2021-03-30 15:28       ` Kirill Kapranov
2021-03-28 21:02 ` [PATCH 3/4] dt-bindings: rtc: abracon,abx80x: Add xt-frequency property Kirill Kapranov
2021-03-28 21:02 ` [PATCH 4/4] rtc:abx80x: Enable xt digital calibration Kirill Kapranov
2021-04-09 10:46   ` Pavel Machek
2021-04-09 16:56     ` Kirill Kapranov
2021-03-28 21:14 ` [PATCH 0/4] rtc:abx80x: Enable distributed " Alexandre Belloni
  -- strict thread matches above, loose matches on Subject: below --
2021-03-29  3:26 [PATCH 2/4] rtc: abx80x: Enable SQW output kernel 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=20210329061956.GJ1717@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=kirill.kapranov@compulab.co.il \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=phdm@macqel.be \
    /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.