From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [cxl:pending 32/43] drivers/cxl/core/port.c:830:21-24: ERROR: port is NULL but dereferenced.
Date: Wed, 09 Feb 2022 19:54:46 +0800 [thread overview]
Message-ID: <202202091956.TdJsTtvj-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 5756 bytes --]
CC: kbuild-all(a)lists.01.org
CC: Alison Schofield <alison.schofield@intel.com>
CC: Vishal Verma <vishal.l.verma@intel.com>
CC: Ira Weiny <ira.weiny@intel.com>
CC: Ben Widawsky <ben.widawsky@intel.com>
CC: Dan Williams <dan.j.williams@intel.com>
CC: linux-kernel(a)vger.kernel.org
TO: Dan Williams <dan.j.williams@intel.com>
CC: Jonathan Cameron <Jonathan.Cameron@huawei.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl.git pending
head: 74b0fe80409733055971bbfaf33c80a33fddeeb3
commit: 2703c16c75aea142c3079ec34ae2262c0557ef7f [32/43] cxl/core/port: Add switch port enumeration
:::::: branch date: 5 hours ago
:::::: commit date: 5 hours ago
config: riscv-randconfig-c004-20220209 (https://download.01.org/0day-ci/archive/20220209/202202091956.TdJsTtvj-lkp(a)intel.com/config)
compiler: riscv64-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
cocci warnings: (new ones prefixed by >>)
>> drivers/cxl/core/port.c:830:21-24: ERROR: port is NULL but dereferenced.
vim +830 drivers/cxl/core/port.c
2703c16c75aea1 Dan Williams 2022-02-04 813
2703c16c75aea1 Dan Williams 2022-02-04 814 static void cxl_detach_ep(void *data)
2703c16c75aea1 Dan Williams 2022-02-04 815 {
2703c16c75aea1 Dan Williams 2022-02-04 816 struct cxl_memdev *cxlmd = data;
2703c16c75aea1 Dan Williams 2022-02-04 817 struct device *iter;
2703c16c75aea1 Dan Williams 2022-02-04 818
2703c16c75aea1 Dan Williams 2022-02-04 819 for (iter = &cxlmd->dev; iter; iter = grandparent(iter)) {
2703c16c75aea1 Dan Williams 2022-02-04 820 struct device *dport_dev = grandparent(iter);
2703c16c75aea1 Dan Williams 2022-02-04 821 struct cxl_port *port, *parent_port;
2703c16c75aea1 Dan Williams 2022-02-04 822 LIST_HEAD(reap_dports);
2703c16c75aea1 Dan Williams 2022-02-04 823 struct cxl_ep *ep;
2703c16c75aea1 Dan Williams 2022-02-04 824
2703c16c75aea1 Dan Williams 2022-02-04 825 if (!dport_dev)
2703c16c75aea1 Dan Williams 2022-02-04 826 break;
2703c16c75aea1 Dan Williams 2022-02-04 827
2703c16c75aea1 Dan Williams 2022-02-04 828 port = find_cxl_port(dport_dev);
2703c16c75aea1 Dan Williams 2022-02-04 829 if (!port || is_cxl_root(port)) {
2703c16c75aea1 Dan Williams 2022-02-04 @830 put_device(&port->dev);
2703c16c75aea1 Dan Williams 2022-02-04 831 continue;
2703c16c75aea1 Dan Williams 2022-02-04 832 }
2703c16c75aea1 Dan Williams 2022-02-04 833
2703c16c75aea1 Dan Williams 2022-02-04 834 parent_port = to_cxl_port(port->dev.parent);
2703c16c75aea1 Dan Williams 2022-02-04 835 cxl_device_lock(&parent_port->dev);
2703c16c75aea1 Dan Williams 2022-02-04 836 if (!parent_port->dev.driver) {
2703c16c75aea1 Dan Williams 2022-02-04 837 /*
2703c16c75aea1 Dan Williams 2022-02-04 838 * The bottom-up race to delete the port lost to a
2703c16c75aea1 Dan Williams 2022-02-04 839 * top-down port disable, give up here, because the
2703c16c75aea1 Dan Williams 2022-02-04 840 * parent_port ->remove() will have cleaned up all
2703c16c75aea1 Dan Williams 2022-02-04 841 * descendants.
2703c16c75aea1 Dan Williams 2022-02-04 842 */
2703c16c75aea1 Dan Williams 2022-02-04 843 cxl_device_unlock(&parent_port->dev);
2703c16c75aea1 Dan Williams 2022-02-04 844 put_device(&port->dev);
2703c16c75aea1 Dan Williams 2022-02-04 845 continue;
2703c16c75aea1 Dan Williams 2022-02-04 846 }
2703c16c75aea1 Dan Williams 2022-02-04 847
2703c16c75aea1 Dan Williams 2022-02-04 848 cxl_device_lock(&port->dev);
2703c16c75aea1 Dan Williams 2022-02-04 849 ep = find_ep(port, &cxlmd->dev);
2703c16c75aea1 Dan Williams 2022-02-04 850 dev_dbg(&cxlmd->dev, "disconnect %s from %s\n",
2703c16c75aea1 Dan Williams 2022-02-04 851 ep ? dev_name(ep->ep) : "", dev_name(&port->dev));
2703c16c75aea1 Dan Williams 2022-02-04 852 cxl_ep_release(ep);
2703c16c75aea1 Dan Williams 2022-02-04 853 if (ep && !port->dead && list_empty(&port->endpoints) &&
2703c16c75aea1 Dan Williams 2022-02-04 854 !is_cxl_root(parent_port)) {
2703c16c75aea1 Dan Williams 2022-02-04 855 /*
2703c16c75aea1 Dan Williams 2022-02-04 856 * This was the last ep attached to a dynamically
2703c16c75aea1 Dan Williams 2022-02-04 857 * enumerated port. Block new cxl_add_ep() and garbage
2703c16c75aea1 Dan Williams 2022-02-04 858 * collect the port.
2703c16c75aea1 Dan Williams 2022-02-04 859 */
2703c16c75aea1 Dan Williams 2022-02-04 860 port->dead = true;
2703c16c75aea1 Dan Williams 2022-02-04 861 list_splice_init(&port->dports, &reap_dports);
2703c16c75aea1 Dan Williams 2022-02-04 862 }
2703c16c75aea1 Dan Williams 2022-02-04 863 cxl_device_unlock(&port->dev);
2703c16c75aea1 Dan Williams 2022-02-04 864
2703c16c75aea1 Dan Williams 2022-02-04 865 if (!list_empty(&reap_dports)) {
2703c16c75aea1 Dan Williams 2022-02-04 866 dev_dbg(&cxlmd->dev, "delete %s\n",
2703c16c75aea1 Dan Williams 2022-02-04 867 dev_name(&port->dev));
2703c16c75aea1 Dan Williams 2022-02-04 868 delete_switch_port(port, &reap_dports);
2703c16c75aea1 Dan Williams 2022-02-04 869 }
2703c16c75aea1 Dan Williams 2022-02-04 870 put_device(&port->dev);
2703c16c75aea1 Dan Williams 2022-02-04 871 cxl_device_unlock(&parent_port->dev);
2703c16c75aea1 Dan Williams 2022-02-04 872 }
2703c16c75aea1 Dan Williams 2022-02-04 873 }
2703c16c75aea1 Dan Williams 2022-02-04 874
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
reply other threads:[~2022-02-09 11:54 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=202202091956.TdJsTtvj-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild@lists.01.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 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.