All of lore.kernel.org
 help / color / mirror / Atom feed
* [soc:drivers/scmi 15/20] drivers/firmware/arm_scmi/clock.c:142:21: sparse: sparse: Using plain integer as NULL pointer
@ 2020-07-17  0:41 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2020-07-17  0:41 UTC (permalink / raw)
  To: Sudeep Holla; +Cc: arm, kbuild-all, linux-arm-kernel

[-- 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [soc:drivers/scmi 15/20] drivers/firmware/arm_scmi/clock.c:142:21: sparse: sparse: Using plain integer as NULL pointer
@ 2020-07-17  0:41 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2020-07-17  0:41 UTC (permalink / raw)
  To: kbuild-all

[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-17  0:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2020-07-17  0:41 ` kernel test robot

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.