All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Sudeep Holla <sudeep.holla@arm.com>
Cc: arm@kernel.org, kbuild-all@lists.01.org,
	linux-arm-kernel@lists.infradead.org
Subject: [soc:drivers/scmi 15/20] drivers/firmware/arm_scmi/clock.c:142:21: sparse: sparse: Using plain integer as NULL pointer
Date: Fri, 17 Jul 2020 08:41:36 +0800	[thread overview]
Message-ID: <202007170833.FR018hSZ%lkp@intel.com> (raw)

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git drivers/scmi
head:   72a5eb9d9c319c99c11cfd9cfb486380dd136840
commit: dccec73de91de04f2a62c877411ecbe368a775f7 [15/20] firmware: arm_scmi: Keep the discrete clock rates sorted
config: arm64-randconfig-s031-20200716 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.2-49-g707c5017-dirty
        git checkout dccec73de91de04f2a62c877411ecbe368a775f7
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arm64 

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


sparse warnings: (new ones prefixed by >>)

>> drivers/firmware/arm_scmi/clock.c:142:21: sparse: sparse: Using plain integer as NULL pointer

vim +142 drivers/firmware/arm_scmi/clock.c

   137	
   138	static int
   139	scmi_clock_describe_rates_get(const struct scmi_handle *handle, u32 clk_id,
   140				      struct scmi_clock_info *clk)
   141	{
 > 142		u64 *rate = 0;
   143		int ret, cnt;
   144		bool rate_discrete = false;
   145		u32 tot_rate_cnt = 0, rates_flag;
   146		u16 num_returned, num_remaining;
   147		struct scmi_xfer *t;
   148		struct scmi_msg_clock_describe_rates *clk_desc;
   149		struct scmi_msg_resp_clock_describe_rates *rlist;
   150	
   151		ret = scmi_xfer_get_init(handle, CLOCK_DESCRIBE_RATES,
   152					 SCMI_PROTOCOL_CLOCK, sizeof(*clk_desc), 0, &t);
   153		if (ret)
   154			return ret;
   155	
   156		clk_desc = t->tx.buf;
   157		rlist = t->rx.buf;
   158	
   159		do {
   160			clk_desc->id = cpu_to_le32(clk_id);
   161			/* Set the number of rates to be skipped/already read */
   162			clk_desc->rate_index = cpu_to_le32(tot_rate_cnt);
   163	
   164			ret = scmi_do_xfer(handle, t);
   165			if (ret)
   166				goto err;
   167	
   168			rates_flag = le32_to_cpu(rlist->num_rates_flags);
   169			num_remaining = NUM_REMAINING(rates_flag);
   170			rate_discrete = RATE_DISCRETE(rates_flag);
   171			num_returned = NUM_RETURNED(rates_flag);
   172	
   173			if (tot_rate_cnt + num_returned > SCMI_MAX_NUM_RATES) {
   174				dev_err(handle->dev, "No. of rates > MAX_NUM_RATES");
   175				break;
   176			}
   177	
   178			if (!rate_discrete) {
   179				clk->range.min_rate = RATE_TO_U64(rlist->rate[0]);
   180				clk->range.max_rate = RATE_TO_U64(rlist->rate[1]);
   181				clk->range.step_size = RATE_TO_U64(rlist->rate[2]);
   182				dev_dbg(handle->dev, "Min %llu Max %llu Step %llu Hz\n",
   183					clk->range.min_rate, clk->range.max_rate,
   184					clk->range.step_size);
   185				break;
   186			}
   187	
   188			rate = &clk->list.rates[tot_rate_cnt];
   189			for (cnt = 0; cnt < num_returned; cnt++, rate++) {
   190				*rate = RATE_TO_U64(rlist->rate[cnt]);
   191				dev_dbg(handle->dev, "Rate %llu Hz\n", *rate);
   192			}
   193	
   194			tot_rate_cnt += num_returned;
   195			/*
   196			 * check for both returned and remaining to avoid infinite
   197			 * loop due to buggy firmware
   198			 */
   199		} while (num_returned && num_remaining);
   200	
   201		if (rate_discrete && rate) {
   202			clk->list.num_rates = tot_rate_cnt;
   203			sort(rate, tot_rate_cnt, sizeof(*rate), rate_cmp_func, NULL);
   204		}
   205	
   206		clk->rate_discrete = rate_discrete;
   207	
   208	err:
   209		scmi_xfer_put(handle, t);
   210		return ret;
   211	}
   212	

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

[-- Attachment #3: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [soc:drivers/scmi 15/20] drivers/firmware/arm_scmi/clock.c:142:21: sparse: sparse: Using plain integer as NULL pointer
Date: Fri, 17 Jul 2020 08:41:36 +0800	[thread overview]
Message-ID: <202007170833.FR018hSZ%lkp@intel.com> (raw)

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git drivers/scmi
head:   72a5eb9d9c319c99c11cfd9cfb486380dd136840
commit: dccec73de91de04f2a62c877411ecbe368a775f7 [15/20] firmware: arm_scmi: Keep the discrete clock rates sorted
config: arm64-randconfig-s031-20200716 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.2-49-g707c5017-dirty
        git checkout dccec73de91de04f2a62c877411ecbe368a775f7
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arm64 

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


sparse warnings: (new ones prefixed by >>)

>> drivers/firmware/arm_scmi/clock.c:142:21: sparse: sparse: Using plain integer as NULL pointer

vim +142 drivers/firmware/arm_scmi/clock.c

   137	
   138	static int
   139	scmi_clock_describe_rates_get(const struct scmi_handle *handle, u32 clk_id,
   140				      struct scmi_clock_info *clk)
   141	{
 > 142		u64 *rate = 0;
   143		int ret, cnt;
   144		bool rate_discrete = false;
   145		u32 tot_rate_cnt = 0, rates_flag;
   146		u16 num_returned, num_remaining;
   147		struct scmi_xfer *t;
   148		struct scmi_msg_clock_describe_rates *clk_desc;
   149		struct scmi_msg_resp_clock_describe_rates *rlist;
   150	
   151		ret = scmi_xfer_get_init(handle, CLOCK_DESCRIBE_RATES,
   152					 SCMI_PROTOCOL_CLOCK, sizeof(*clk_desc), 0, &t);
   153		if (ret)
   154			return ret;
   155	
   156		clk_desc = t->tx.buf;
   157		rlist = t->rx.buf;
   158	
   159		do {
   160			clk_desc->id = cpu_to_le32(clk_id);
   161			/* Set the number of rates to be skipped/already read */
   162			clk_desc->rate_index = cpu_to_le32(tot_rate_cnt);
   163	
   164			ret = scmi_do_xfer(handle, t);
   165			if (ret)
   166				goto err;
   167	
   168			rates_flag = le32_to_cpu(rlist->num_rates_flags);
   169			num_remaining = NUM_REMAINING(rates_flag);
   170			rate_discrete = RATE_DISCRETE(rates_flag);
   171			num_returned = NUM_RETURNED(rates_flag);
   172	
   173			if (tot_rate_cnt + num_returned > SCMI_MAX_NUM_RATES) {
   174				dev_err(handle->dev, "No. of rates > MAX_NUM_RATES");
   175				break;
   176			}
   177	
   178			if (!rate_discrete) {
   179				clk->range.min_rate = RATE_TO_U64(rlist->rate[0]);
   180				clk->range.max_rate = RATE_TO_U64(rlist->rate[1]);
   181				clk->range.step_size = RATE_TO_U64(rlist->rate[2]);
   182				dev_dbg(handle->dev, "Min %llu Max %llu Step %llu Hz\n",
   183					clk->range.min_rate, clk->range.max_rate,
   184					clk->range.step_size);
   185				break;
   186			}
   187	
   188			rate = &clk->list.rates[tot_rate_cnt];
   189			for (cnt = 0; cnt < num_returned; cnt++, rate++) {
   190				*rate = RATE_TO_U64(rlist->rate[cnt]);
   191				dev_dbg(handle->dev, "Rate %llu Hz\n", *rate);
   192			}
   193	
   194			tot_rate_cnt += num_returned;
   195			/*
   196			 * check for both returned and remaining to avoid infinite
   197			 * loop due to buggy firmware
   198			 */
   199		} while (num_returned && num_remaining);
   200	
   201		if (rate_discrete && rate) {
   202			clk->list.num_rates = tot_rate_cnt;
   203			sort(rate, tot_rate_cnt, sizeof(*rate), rate_cmp_func, NULL);
   204		}
   205	
   206		clk->rate_discrete = rate_discrete;
   207	
   208	err:
   209		scmi_xfer_put(handle, t);
   210		return ret;
   211	}
   212	

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

             reply	other threads:[~2020-07-17  0:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-17  0:41 kernel test robot [this message]
2020-07-17  0:41 ` [soc:drivers/scmi 15/20] drivers/firmware/arm_scmi/clock.c:142:21: sparse: sparse: Using plain integer as NULL pointer 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=202007170833.FR018hSZ%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=arm@kernel.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=sudeep.holla@arm.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.