2024-05-23 01:27:44

by kernel test robot

[permalink] [raw]
Subject: drivers/mailbox/zynqmp-ipi-mailbox.c:914:15: sparse: sparse: incorrect type in assignment (different address spaces)

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: de7e71ef8bed222dd144d8878091ecb6d5dfd208
commit: 6ffb1635341bec50fa9540ae7827d1e5d75ae0b0 mailbox: zynqmp: handle SGI for shared IPI
date: 3 days ago
config: arm64-randconfig-r132-20240523 (https://download.01.org/0day-ci/archive/20240523/[email protected]/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project fa9b1be45088dce1e4b602d451f118128b94237b)
reproduce: (https://download.01.org/0day-ci/archive/20240523/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)
>> drivers/mailbox/zynqmp-ipi-mailbox.c:914:15: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct zynqmp_ipi_pdata [noderef] __percpu *pdata @@ got void * @@
drivers/mailbox/zynqmp-ipi-mailbox.c:914:15: sparse: expected struct zynqmp_ipi_pdata [noderef] __percpu *pdata
drivers/mailbox/zynqmp-ipi-mailbox.c:914:15: sparse: got void *
>> drivers/mailbox/zynqmp-ipi-mailbox.c:921:56: sparse: sparse: incorrect type in argument 3 (different address spaces) @@ expected unsigned int [usertype] *out_value @@ got unsigned int [noderef] __percpu * @@
drivers/mailbox/zynqmp-ipi-mailbox.c:921:56: sparse: expected unsigned int [usertype] *out_value
drivers/mailbox/zynqmp-ipi-mailbox.c:921:56: sparse: got unsigned int [noderef] __percpu *
>> drivers/mailbox/zynqmp-ipi-mailbox.c:936:14: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct zynqmp_ipi_mbox *mbox @@ got struct zynqmp_ipi_mbox [noderef] __percpu * @@
drivers/mailbox/zynqmp-ipi-mailbox.c:936:14: sparse: expected struct zynqmp_ipi_mbox *mbox
drivers/mailbox/zynqmp-ipi-mailbox.c:936:14: sparse: got struct zynqmp_ipi_mbox [noderef] __percpu *
>> drivers/mailbox/zynqmp-ipi-mailbox.c:940:29: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct zynqmp_ipi_pdata *pdata @@ got struct zynqmp_ipi_pdata [noderef] __percpu *pdata @@
drivers/mailbox/zynqmp-ipi-mailbox.c:940:29: sparse: expected struct zynqmp_ipi_pdata *pdata
drivers/mailbox/zynqmp-ipi-mailbox.c:940:29: sparse: got struct zynqmp_ipi_pdata [noderef] __percpu *pdata
>> drivers/mailbox/zynqmp-ipi-mailbox.c:964:60: sparse: sparse: incorrect type in argument 3 (different address spaces) @@ expected struct zynqmp_ipi_pdata *pdata @@ got struct zynqmp_ipi_pdata [noderef] __percpu *pdata @@
drivers/mailbox/zynqmp-ipi-mailbox.c:964:60: sparse: expected struct zynqmp_ipi_pdata *pdata
drivers/mailbox/zynqmp-ipi-mailbox.c:964:60: sparse: got struct zynqmp_ipi_pdata [noderef] __percpu *pdata
>> drivers/mailbox/zynqmp-ipi-mailbox.c:974:68: sparse: sparse: incorrect type in argument 6 (different address spaces) @@ expected void *dev_id @@ got struct zynqmp_ipi_pdata [noderef] __percpu *pdata @@
drivers/mailbox/zynqmp-ipi-mailbox.c:974:68: sparse: expected void *dev_id
drivers/mailbox/zynqmp-ipi-mailbox.c:974:68: sparse: got struct zynqmp_ipi_pdata [noderef] __percpu *pdata
>> drivers/mailbox/zynqmp-ipi-mailbox.c:983:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void *data @@ got struct zynqmp_ipi_pdata [noderef] __percpu *pdata @@
drivers/mailbox/zynqmp-ipi-mailbox.c:983:36: sparse: expected void *data
drivers/mailbox/zynqmp-ipi-mailbox.c:983:36: sparse: got struct zynqmp_ipi_pdata [noderef] __percpu *pdata
drivers/mailbox/zynqmp-ipi-mailbox.c:987:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct zynqmp_ipi_pdata *pdata @@ got struct zynqmp_ipi_pdata [noderef] __percpu *pdata @@
drivers/mailbox/zynqmp-ipi-mailbox.c:987:32: sparse: expected struct zynqmp_ipi_pdata *pdata
drivers/mailbox/zynqmp-ipi-mailbox.c:987:32: sparse: got struct zynqmp_ipi_pdata [noderef] __percpu *pdata
>> drivers/mailbox/zynqmp-ipi-mailbox.c:918:9: sparse: sparse: dereference of noderef expression
drivers/mailbox/zynqmp-ipi-mailbox.c:934:9: sparse: sparse: dereference of noderef expression
drivers/mailbox/zynqmp-ipi-mailbox.c:963:17: sparse: sparse: dereference of noderef expression
drivers/mailbox/zynqmp-ipi-mailbox.c:964:48: sparse: sparse: dereference of noderef expression
drivers/mailbox/zynqmp-ipi-mailbox.c:972:17: sparse: sparse: dereference of noderef expression
drivers/mailbox/zynqmp-ipi-mailbox.c:973:45: sparse: sparse: dereference of noderef expression
drivers/mailbox/zynqmp-ipi-mailbox.c:973:45: sparse: sparse: dereference of noderef expression
drivers/mailbox/zynqmp-ipi-mailbox.c:978:17: sparse: sparse: dereference of noderef expression

vim +914 drivers/mailbox/zynqmp-ipi-mailbox.c

4981b82ba2ff87 Wendy Liang 2019-02-21 897
4981b82ba2ff87 Wendy Liang 2019-02-21 898 static int zynqmp_ipi_probe(struct platform_device *pdev)
4981b82ba2ff87 Wendy Liang 2019-02-21 899 {
4981b82ba2ff87 Wendy Liang 2019-02-21 900 struct device *dev = &pdev->dev;
4981b82ba2ff87 Wendy Liang 2019-02-21 901 struct device_node *nc, *np = pdev->dev.of_node;
6ffb1635341bec Tanmay Shah 2024-05-03 902 struct zynqmp_ipi_pdata __percpu *pdata;
6ffb1635341bec Tanmay Shah 2024-05-03 903 struct of_phandle_args out_irq;
4981b82ba2ff87 Wendy Liang 2019-02-21 904 struct zynqmp_ipi_mbox *mbox;
4981b82ba2ff87 Wendy Liang 2019-02-21 905 int num_mboxes, ret = -EINVAL;
41bcf30100c521 Ben Levinsky 2024-04-10 906 setup_ipi_fn ipi_fn;
4981b82ba2ff87 Wendy Liang 2019-02-21 907
f72f805e72882c Tanmay Shah 2023-03-10 908 num_mboxes = of_get_available_child_count(np);
f72f805e72882c Tanmay Shah 2023-03-10 909 if (num_mboxes == 0) {
f72f805e72882c Tanmay Shah 2023-03-10 910 dev_err(dev, "mailbox nodes not available\n");
f72f805e72882c Tanmay Shah 2023-03-10 911 return -EINVAL;
f72f805e72882c Tanmay Shah 2023-03-10 912 }
f72f805e72882c Tanmay Shah 2023-03-10 913
043f85ce81cb17 Christophe JAILLET 2022-11-20 @914 pdata = devm_kzalloc(dev, struct_size(pdata, ipi_mboxes, num_mboxes),
4981b82ba2ff87 Wendy Liang 2019-02-21 915 GFP_KERNEL);
4981b82ba2ff87 Wendy Liang 2019-02-21 916 if (!pdata)
4981b82ba2ff87 Wendy Liang 2019-02-21 917 return -ENOMEM;
4981b82ba2ff87 Wendy Liang 2019-02-21 @918 pdata->dev = dev;
4981b82ba2ff87 Wendy Liang 2019-02-21 919
4981b82ba2ff87 Wendy Liang 2019-02-21 920 /* Get the IPI local agents ID */
4981b82ba2ff87 Wendy Liang 2019-02-21 @921 ret = of_property_read_u32(np, "xlnx,ipi-id", &pdata->local_id);
4981b82ba2ff87 Wendy Liang 2019-02-21 922 if (ret < 0) {
4981b82ba2ff87 Wendy Liang 2019-02-21 923 dev_err(dev, "No IPI local ID is specified.\n");
4981b82ba2ff87 Wendy Liang 2019-02-21 924 return ret;
4981b82ba2ff87 Wendy Liang 2019-02-21 925 }
4981b82ba2ff87 Wendy Liang 2019-02-21 926
41bcf30100c521 Ben Levinsky 2024-04-10 927 ipi_fn = (setup_ipi_fn)device_get_match_data(&pdev->dev);
41bcf30100c521 Ben Levinsky 2024-04-10 928 if (!ipi_fn) {
41bcf30100c521 Ben Levinsky 2024-04-10 929 dev_err(dev,
41bcf30100c521 Ben Levinsky 2024-04-10 930 "Mbox Compatible String is missing IPI Setup fn.\n");
41bcf30100c521 Ben Levinsky 2024-04-10 931 return -ENODEV;
41bcf30100c521 Ben Levinsky 2024-04-10 932 }
41bcf30100c521 Ben Levinsky 2024-04-10 933
4981b82ba2ff87 Wendy Liang 2019-02-21 934 pdata->num_mboxes = num_mboxes;
4981b82ba2ff87 Wendy Liang 2019-02-21 935
4981b82ba2ff87 Wendy Liang 2019-02-21 @936 mbox = pdata->ipi_mboxes;
41bcf30100c521 Ben Levinsky 2024-04-10 937 mbox->setup_ipi_fn = ipi_fn;
41bcf30100c521 Ben Levinsky 2024-04-10 938
4981b82ba2ff87 Wendy Liang 2019-02-21 939 for_each_available_child_of_node(np, nc) {
4981b82ba2ff87 Wendy Liang 2019-02-21 @940 mbox->pdata = pdata;
4981b82ba2ff87 Wendy Liang 2019-02-21 941 ret = zynqmp_ipi_mbox_probe(mbox, nc);
4981b82ba2ff87 Wendy Liang 2019-02-21 942 if (ret) {
2453128847ca1e Wang Qing 2021-12-13 943 of_node_put(nc);
4981b82ba2ff87 Wendy Liang 2019-02-21 944 dev_err(dev, "failed to probe subdev.\n");
4981b82ba2ff87 Wendy Liang 2019-02-21 945 ret = -EINVAL;
4981b82ba2ff87 Wendy Liang 2019-02-21 946 goto free_mbox_dev;
4981b82ba2ff87 Wendy Liang 2019-02-21 947 }
4981b82ba2ff87 Wendy Liang 2019-02-21 948 mbox++;
4981b82ba2ff87 Wendy Liang 2019-02-21 949 }
4981b82ba2ff87 Wendy Liang 2019-02-21 950
6ffb1635341bec Tanmay Shah 2024-05-03 951 ret = of_irq_parse_one(dev_of_node(dev), 0, &out_irq);
6ffb1635341bec Tanmay Shah 2024-05-03 952 if (ret < 0) {
6ffb1635341bec Tanmay Shah 2024-05-03 953 dev_err(dev, "failed to parse interrupts\n");
6ffb1635341bec Tanmay Shah 2024-05-03 954 goto free_mbox_dev;
6ffb1635341bec Tanmay Shah 2024-05-03 955 }
6ffb1635341bec Tanmay Shah 2024-05-03 956 ret = out_irq.args[1];
6ffb1635341bec Tanmay Shah 2024-05-03 957
6ffb1635341bec Tanmay Shah 2024-05-03 958 /*
6ffb1635341bec Tanmay Shah 2024-05-03 959 * If Interrupt number is in SGI range, then request SGI else request
6ffb1635341bec Tanmay Shah 2024-05-03 960 * IPI system IRQ.
6ffb1635341bec Tanmay Shah 2024-05-03 961 */
6ffb1635341bec Tanmay Shah 2024-05-03 962 if (ret < MAX_SGI) {
6ffb1635341bec Tanmay Shah 2024-05-03 963 pdata->irq = ret;
6ffb1635341bec Tanmay Shah 2024-05-03 @964 ret = xlnx_mbox_init_sgi(pdev, pdata->irq, pdata);
6ffb1635341bec Tanmay Shah 2024-05-03 965 if (ret)
6ffb1635341bec Tanmay Shah 2024-05-03 966 goto free_mbox_dev;
6ffb1635341bec Tanmay Shah 2024-05-03 967 } else {
4981b82ba2ff87 Wendy Liang 2019-02-21 968 ret = platform_get_irq(pdev, 0);
ec32481b1669ad Markus Elfring 2020-04-05 969 if (ret < 0)
4981b82ba2ff87 Wendy Liang 2019-02-21 970 goto free_mbox_dev;
ec32481b1669ad Markus Elfring 2020-04-05 971
4981b82ba2ff87 Wendy Liang 2019-02-21 972 pdata->irq = ret;
4981b82ba2ff87 Wendy Liang 2019-02-21 973 ret = devm_request_irq(dev, pdata->irq, zynqmp_ipi_interrupt,
4981b82ba2ff87 Wendy Liang 2019-02-21 @974 IRQF_SHARED, dev_name(dev), pdata);
6ffb1635341bec Tanmay Shah 2024-05-03 975 }
6ffb1635341bec Tanmay Shah 2024-05-03 976
4981b82ba2ff87 Wendy Liang 2019-02-21 977 if (ret) {
4981b82ba2ff87 Wendy Liang 2019-02-21 978 dev_err(dev, "IRQ %d is not requested successfully.\n",
4981b82ba2ff87 Wendy Liang 2019-02-21 979 pdata->irq);
4981b82ba2ff87 Wendy Liang 2019-02-21 980 goto free_mbox_dev;
4981b82ba2ff87 Wendy Liang 2019-02-21 981 }
4981b82ba2ff87 Wendy Liang 2019-02-21 982
4981b82ba2ff87 Wendy Liang 2019-02-21 @983 platform_set_drvdata(pdev, pdata);
4981b82ba2ff87 Wendy Liang 2019-02-21 984 return ret;
4981b82ba2ff87 Wendy Liang 2019-02-21 985
4981b82ba2ff87 Wendy Liang 2019-02-21 986 free_mbox_dev:
4981b82ba2ff87 Wendy Liang 2019-02-21 987 zynqmp_ipi_free_mboxes(pdata);
4981b82ba2ff87 Wendy Liang 2019-02-21 988 return ret;
4981b82ba2ff87 Wendy Liang 2019-02-21 989 }
4981b82ba2ff87 Wendy Liang 2019-02-21 990

:::::: The code at line 914 was first introduced by commit
:::::: 043f85ce81cb1714e14d31c322c5646513dde3fb mailbox: zynq: Switch to flexible array to simplify code

:::::: TO: Christophe JAILLET <[email protected]>
:::::: CC: Jassi Brar <[email protected]>

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