Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Chen-Yu Tsai <wenst@chromium.org>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [wens:mtk-wip 31/45] drivers/platform/chrome/chromeos_of_hw_prober.c:102:27: error: use of undeclared identifier '__free_kfree'; did you mean '__free_pages'?
Date: Sat, 14 Sep 2024 17:35:50 +0800	[thread overview]
Message-ID: <202409141714.eGNqxwW6-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/wens/linux.git mtk-wip
head:   42c21929aeb3c7ca7b0ce9cacb1d0ff915d3c783
commit: 2356afb129312b111cc39b588356445f3b598c63 [31/45] platform/chrome: of_hw_prober: Support SKU ID based component selection
config: i386-randconfig-006-20240914 (https://download.01.org/0day-ci/archive/20240914/202409141714.eGNqxwW6-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240914/202409141714.eGNqxwW6-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409141714.eGNqxwW6-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/platform/chrome/chromeos_of_hw_prober.c:102:27: error: use of undeclared identifier '__free_kfree'; did you mean '__free_pages'?
     102 |         struct of_changeset *ocs __free(kfree) = kzalloc(sizeof(*ocs), GFP_KERNEL);
         |                                  ^
   include/linux/cleanup.h:200:33: note: expanded from macro '__free'
     200 | #define __free(_name)   __cleanup(__free_##_name)
         |                                   ^
   <scratch space>:150:1: note: expanded from here
     150 | __free_kfree
         | ^
   include/linux/gfp.h:371:13: note: '__free_pages' declared here
     371 | extern void __free_pages(struct page *page, unsigned int order);
         |             ^
>> drivers/platform/chrome/chromeos_of_hw_prober.c:102:27: error: 'cleanup' function '__free_pages' must take 1 parameter
     102 |         struct of_changeset *ocs __free(kfree) = kzalloc(sizeof(*ocs), GFP_KERNEL);
         |                                  ^
   include/linux/cleanup.h:200:33: note: expanded from macro '__free'
     200 | #define __free(_name)   __cleanup(__free_##_name)
         |                                   ^
   <scratch space>:150:1: note: expanded from here
     150 | __free_kfree
         | ^
>> drivers/platform/chrome/chromeos_of_hw_prober.c:102:43: error: call to undeclared function 'kzalloc'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     102 |         struct of_changeset *ocs __free(kfree) = kzalloc(sizeof(*ocs), GFP_KERNEL);
         |                                                  ^
>> drivers/platform/chrome/chromeos_of_hw_prober.c:102:23: error: incompatible integer to pointer conversion initializing 'struct of_changeset *' with an expression of type 'int' [-Wint-conversion]
     102 |         struct of_changeset *ocs __free(kfree) = kzalloc(sizeof(*ocs), GFP_KERNEL);
         |                              ^                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   4 errors generated.


vim +102 drivers/platform/chrome/chromeos_of_hw_prober.c

    57	
    58	/*
    59	 * chromeos_sku_component_selector - Selectively enable a component based on SKU ID
    60	 *
    61	 * Based on the list of component options and SKU ID read back from the device
    62	 * tree, enable the matching component. Also update the OF graph if it exists,
    63	 * so that the enabled component's remote endpoint correctly points to it. This
    64	 * assumes a single local endpoint, which should be the case for panels and
    65	 * camera sensors.
    66	 */
    67	static int chromeos_sku_component_selector(struct device *dev, const void *data)
    68	{
    69		const struct chromeos_sku_component_data *pdata = data;
    70		const char *compatible;
    71		void *ptr __always_unused;
    72		int ret;
    73		u32 sku_id = 0;
    74	
    75		if (!data)
    76			return dev_err_probe(dev, -EINVAL, "No data given\n");
    77	
    78		ret = chromeos_get_coreboot_sku_id(dev, &sku_id);
    79		if (ret)
    80			return ret;
    81	
    82		compatible = NULL;
    83		for (unsigned int i = 0; i < pdata->num_options; i++)
    84			if ((sku_id & pdata->options[i].sku_id_mask) == pdata->options[i].sku_id_val) {
    85				compatible = pdata->options->compatible;
    86				break;
    87			}
    88	
    89		if (!compatible)
    90			return dev_err_probe(dev, -EINVAL, "Unknown SKU ID: 0x%x\n", sku_id);
    91	
    92		struct device_node *node __free(device_node) = of_find_compatible_node(NULL, NULL, compatible);
    93		if (!node)
    94			return dev_err_probe(dev, -ENODEV, "Cannot find matching device node\n");
    95	
    96		/* device node not marked as fail; don't mess with the device tree */
    97		if (!of_device_is_fail(node))
    98			return 0;
    99	
   100		dev_info(dev, "Enabling %pOF for SKU 0x%x\n", node, sku_id);
   101	
 > 102		struct of_changeset *ocs __free(kfree) = kzalloc(sizeof(*ocs), GFP_KERNEL);
   103		if (!ocs)
   104			return -ENOMEM;
   105	
   106		/* Create changeset to apply DT changes atomically */
   107		of_changeset_init(ocs);
   108	
   109		if (of_graph_is_present(node)) {
   110			ret = -EINVAL;
   111	
   112			/* This currently assumes a single port on the component. */
   113			struct device_node *endpoint __free(device_node) = of_graph_get_next_endpoint(node, NULL);
   114			if (!endpoint) {
   115				dev_err(dev, "No endpoint found for %pOF\n", node);
   116				goto err_destroy_ocs;
   117			}
   118	
   119			struct device_node *remote __free(device_node) = of_graph_get_remote_endpoint(endpoint);
   120			if (!remote) {
   121				dev_err(dev, "No remote endpoint node found for %pOF\n", endpoint);
   122				goto err_destroy_ocs;
   123			}
   124	
   125			ret = of_changeset_update_prop_u32(ocs, node, "remote-endpoint", endpoint->phandle);
   126			if (ret)
   127				goto err_destroy_ocs;
   128		}
   129	
   130		ret = of_changeset_update_prop_string(ocs, node, "status", "okay");
   131		if (ret)
   132			goto err_destroy_ocs;
   133		ret = of_changeset_apply(ocs);
   134		if (ret)
   135			goto err_destroy_ocs;
   136	
   137		/*
   138		 * ocs is intentionally kept around as it needs to
   139		 * exist as long as the change is applied.
   140		 */
   141		ptr = no_free_ptr(ocs);
   142	
   143		return 0;
   144	
   145	err_destroy_ocs:
   146		of_changeset_destroy(ocs);
   147		return ret;
   148	}
   149	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2024-09-14  9:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202409141714.eGNqxwW6-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=wenst@chromium.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox