Linux-Rockchip Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev, "Damien Le Moal" <dlemoal@kernel.org>,
	"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Shawn Lin" <shawn.lin@rock-chips.com>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Bjorn Helgaas" <helgaas@kernel.org>,
	"Heiko Stuebner" <heiko@sntech.de>,
	linux-pci@vger.kernel.org, "Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	devicetree@vger.kernel.org
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
	linux-rockchip@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	Rick Wertenbroek <rick.wertenbroek@gmail.com>,
	Wilfred Mallawa <wilfred.mallawa@wdc.com>,
	Niklas Cassel <cassel@kernel.org>
Subject: Re: [PATCH v2 02/18] PCI: endpoint: Introduce pci_epc_map_align()
Date: Fri, 5 Apr 2024 11:38:35 +0300	[thread overview]
Message-ID: <2b9ad9b2-c5df-4364-99cb-c2b41cdfee52@moroto.mountain> (raw)
In-Reply-To: <20240330041928.1555578-3-dlemoal@kernel.org>

Hi Damien,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Damien-Le-Moal/PCI-endpoint-Introduce-pci_epc_function_is_valid/20240330-122311
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next
patch link:    https://lore.kernel.org/r/20240330041928.1555578-3-dlemoal%40kernel.org
patch subject: [PATCH v2 02/18] PCI: endpoint: Introduce pci_epc_map_align()
config: parisc-randconfig-r071-20240405 (https://download.01.org/0day-ci/archive/20240405/202404051508.hvNRDVZq-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 13.2.0

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>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202404051508.hvNRDVZq-lkp@intel.com/

smatch warnings:
drivers/pci/endpoint/pci-epc-core.c:493 pci_epc_map_align() error: we previously assumed 'features' could be null (see line 487)

vim +/features +493 drivers/pci/endpoint/pci-epc-core.c

9d2f10d2ace040 Damien Le Moal         2024-03-30  458  int pci_epc_map_align(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
9d2f10d2ace040 Damien Le Moal         2024-03-30  459  		      u64 pci_addr, size_t size, struct pci_epc_map *map)
9d2f10d2ace040 Damien Le Moal         2024-03-30  460  {
9d2f10d2ace040 Damien Le Moal         2024-03-30  461  	const struct pci_epc_features *features;
9d2f10d2ace040 Damien Le Moal         2024-03-30  462  	size_t mask;
9d2f10d2ace040 Damien Le Moal         2024-03-30  463  	int ret;
9d2f10d2ace040 Damien Le Moal         2024-03-30  464  
9d2f10d2ace040 Damien Le Moal         2024-03-30  465  	if (!pci_epc_function_is_valid(epc, func_no, vfunc_no))
9d2f10d2ace040 Damien Le Moal         2024-03-30  466  		return -EINVAL;
9d2f10d2ace040 Damien Le Moal         2024-03-30  467  
9d2f10d2ace040 Damien Le Moal         2024-03-30  468  	if (!size || !map)
9d2f10d2ace040 Damien Le Moal         2024-03-30  469  		return -EINVAL;
9d2f10d2ace040 Damien Le Moal         2024-03-30  470  
9d2f10d2ace040 Damien Le Moal         2024-03-30  471  	memset(map, 0, sizeof(*map));
9d2f10d2ace040 Damien Le Moal         2024-03-30  472  	map->pci_addr = pci_addr;
9d2f10d2ace040 Damien Le Moal         2024-03-30  473  	map->pci_size = size;
9d2f10d2ace040 Damien Le Moal         2024-03-30  474  
9d2f10d2ace040 Damien Le Moal         2024-03-30  475  	if (epc->ops->map_align) {
9d2f10d2ace040 Damien Le Moal         2024-03-30  476  		mutex_lock(&epc->lock);
9d2f10d2ace040 Damien Le Moal         2024-03-30  477  		ret = epc->ops->map_align(epc, func_no, vfunc_no, map);
9d2f10d2ace040 Damien Le Moal         2024-03-30  478  		mutex_unlock(&epc->lock);
9d2f10d2ace040 Damien Le Moal         2024-03-30  479  		return ret;
9d2f10d2ace040 Damien Le Moal         2024-03-30  480  	}
9d2f10d2ace040 Damien Le Moal         2024-03-30  481  
9d2f10d2ace040 Damien Le Moal         2024-03-30  482  	/*
9d2f10d2ace040 Damien Le Moal         2024-03-30  483  	 * Assume a fixed alignment constraint as specified by the controller
9d2f10d2ace040 Damien Le Moal         2024-03-30  484  	 * features.
9d2f10d2ace040 Damien Le Moal         2024-03-30  485  	 */
9d2f10d2ace040 Damien Le Moal         2024-03-30  486  	features = pci_epc_get_features(epc, func_no, vfunc_no);
9d2f10d2ace040 Damien Le Moal         2024-03-30 @487  	if (!features || !features->align) {
                                                            ^^^^^^^^^
Check for NULL

9d2f10d2ace040 Damien Le Moal         2024-03-30  488  		map->map_pci_addr = pci_addr;
9d2f10d2ace040 Damien Le Moal         2024-03-30  489  		map->map_size = size;
9d2f10d2ace040 Damien Le Moal         2024-03-30  490  		map->map_ofst = 0;

Missing return 0?

9d2f10d2ace040 Damien Le Moal         2024-03-30  491  	}
9d2f10d2ace040 Damien Le Moal         2024-03-30  492  
9d2f10d2ace040 Damien Le Moal         2024-03-30 @493  	mask = features->align - 1;
                                                               ^^^^^^^^^^

9d2f10d2ace040 Damien Le Moal         2024-03-30  494  	map->map_pci_addr = map->pci_addr & ~mask;
9d2f10d2ace040 Damien Le Moal         2024-03-30  495  	map->map_ofst = map->pci_addr & mask;
9d2f10d2ace040 Damien Le Moal         2024-03-30  496  	map->map_size = ALIGN(map->map_ofst + map->pci_size, features->align);
9d2f10d2ace040 Damien Le Moal         2024-03-30  497  
9d2f10d2ace040 Damien Le Moal         2024-03-30  498  	return 0;
9d2f10d2ace040 Damien Le Moal         2024-03-30  499  }

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


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  parent reply	other threads:[~2024-04-05  8:38 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-30  4:19 [PATCH v2 00/18] Improve PCI memory mapping API Damien Le Moal
2024-03-30  4:19 ` [PATCH v2 01/18] PCI: endpoint: Introduce pci_epc_function_is_valid() Damien Le Moal
2024-04-03  6:46   ` Manivannan Sadhasivam
2024-04-05 13:33   ` Niklas Cassel
2024-03-30  4:19 ` [PATCH v2 02/18] PCI: endpoint: Introduce pci_epc_map_align() Damien Le Moal
2024-04-03  7:45   ` Manivannan Sadhasivam
2024-04-03  7:54     ` Damien Le Moal
2024-04-03  9:21       ` Manivannan Sadhasivam
2024-04-03 12:33   ` Kishon Vijay Abraham I
2024-04-04  2:43     ` Damien Le Moal
2024-04-05 12:20       ` Niklas Cassel
2024-04-05 12:43         ` Damien Le Moal
2024-04-05 15:18           ` Niklas Cassel
2024-04-10 11:57         ` Kishon Vijay Abraham I
2024-04-05  8:38   ` Dan Carpenter [this message]
2024-03-30  4:19 ` [PATCH v2 03/18] PCI: endpoint: Introduce pci_epc_mem_map()/unmap() Damien Le Moal
2024-04-03  9:48   ` Manivannan Sadhasivam
2024-04-05 14:10   ` Niklas Cassel
2024-03-30  4:19 ` [PATCH v2 04/18] PCI: endpoint: test: Use pci_epc_mem_map/unmap() Damien Le Moal
2024-04-05 13:37   ` Niklas Cassel
2024-03-30  4:19 ` [PATCH v2 05/18] PCI: endpoint: test: Synchronously cancel command handler work Damien Le Moal
2024-04-03  7:47   ` Manivannan Sadhasivam
2024-04-05 13:41     ` Niklas Cassel
2024-03-30  4:19 ` [PATCH v2 06/18] PCI: endpoint: test: Implement link_down event operation Damien Le Moal
2024-04-03  7:48   ` Manivannan Sadhasivam
2024-04-05 13:39     ` Niklas Cassel
2024-04-06  2:24       ` Manivannan Sadhasivam
2024-03-30  4:19 ` [PATCH v2 07/18] PCI: rockchip-ep: Fix address translation unit programming Damien Le Moal
2024-03-30  4:19 ` [PATCH v2 08/18] PCI: rockchip-ep: Use a macro to define EP controller .align feature Damien Le Moal
2024-03-30  4:19 ` [PATCH v2 09/18] PCI: rockchip-ep: Improve rockchip_pcie_ep_unmap_addr() Damien Le Moal
2024-03-30  4:19 ` [PATCH v2 10/18] PCI: rockchip-ep: Improve rockchip_pcie_ep_map_addr() Damien Le Moal
2024-03-30  4:19 ` [PATCH v2 11/18] PCI: rockchip-ep: Implement the map_align endpoint controller operation Damien Le Moal
2024-03-30  4:19 ` [PATCH v2 12/18] PCI: rockchip-ep: Refactor rockchip_pcie_ep_probe() memory allocations Damien Le Moal
2024-03-30  4:19 ` [PATCH v2 13/18] PCI: rockchip-ep: Refactor rockchip_pcie_ep_probe() MSI-X hiding Damien Le Moal
2024-03-30  4:19 ` [PATCH v2 14/18] PCI: rockchip-ep: Refactor endpoint link training enable Damien Le Moal
2024-03-30  4:19 ` [PATCH v2 15/18] PCI: rockship-ep: Introduce rockchip_pcie_ep_stop() Damien Le Moal
2024-03-30  4:19 ` [PATCH v2 16/18] PCI: rockchip-ep: Improve link training Damien Le Moal
2024-04-03 11:54   ` Rick Wertenbroek
2024-03-30  4:19 ` [PATCH v2 17/18] dt-bindings: pci: rockchip,rk3399-pcie-ep: Add ep-gpios property Damien Le Moal
2024-03-30  9:16   ` Krzysztof Kozlowski
2024-03-31 23:06     ` Damien Le Moal
2024-04-01  9:57       ` Krzysztof Kozlowski
2024-04-01 23:36         ` Damien Le Moal
2024-04-02  7:33           ` Krzysztof Kozlowski
2024-04-02  7:38             ` Damien Le Moal
2024-04-02  7:55               ` Damien Le Moal
2024-04-02 18:10                 ` Krzysztof Kozlowski
2024-04-02 23:23                   ` Damien Le Moal
2024-04-02  7:38             ` Damien Le Moal
2024-03-30  4:19 ` [PATCH v2 18/18] PCI: rockchip-ep: Handle PERST# signal in endpoint mode Damien Le Moal
2024-04-02 12:36 ` [PATCH v2 00/18] Improve PCI memory mapping API Rick Wertenbroek
2024-04-03  7:50 ` Manivannan Sadhasivam
2024-04-03  7:58   ` Damien Le Moal
2024-04-03  9:25     ` Manivannan Sadhasivam

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=2b9ad9b2-c5df-4364-99cb-c2b41cdfee52@moroto.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=cassel@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=heiko@sntech.de \
    --cc=helgaas@kernel.org \
    --cc=kishon@kernel.org \
    --cc=krzk@kernel.org \
    --cc=kw@linux.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=lkp@intel.com \
    --cc=lpieralisi@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oe-kbuild@lists.linux.dev \
    --cc=rick.wertenbroek@gmail.com \
    --cc=robh@kernel.org \
    --cc=shawn.lin@rock-chips.com \
    --cc=wilfred.mallawa@wdc.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox