Re: [PATCH for-next v4 10/12] RDMA/erdma: Add the erdma module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2022/3/14 14:47, Cheng Xu wrote:
> Add the main erdma module and debugfs files. The main module provides
> interface to infiniband subsytem, and the debugfs module provides a way
> to allow user can get the core status of the device and set the preferred
> congestion control algorithm.

subsytem -> subsystem.

<...>
> +static int erdma_request_vectors(struct erdma_dev *dev)
> +{
> +	int expect_irq_num = num_possible_cpus() + 1;
> +
> +	if (expect_irq_num > ERDMA_NUM_MSIX_VEC)
> +		expect_irq_num = ERDMA_NUM_MSIX_VEC;
> +

Consider using min() to value expect_irq_num.

<...>
> +static int erdma_probe_dev(struct pci_dev *pdev)
> +{
> +	int err;
> +	struct erdma_dev *dev;
> +	u32 version;
> +	int bars;
> +
> +	err = pci_enable_device(pdev);
> +	if (err) {
> +		dev_err(&pdev->dev, "pci_enable_device failed(%d)\n", err);
> +		return err;
> +	}
> +
> +	pci_set_master(pdev);
> +
> +	dev = ib_alloc_device(erdma_dev, ibdev);
> +	if (!dev) {
> +		dev_err(&pdev->dev, "ib_alloc_device failed\n");
> +		err = -ENOMEM;
> +		goto err_disable_device;
> +	}
> +
> +	pci_set_drvdata(pdev, dev);
> +	dev->pdev = pdev;
> +	dev->attrs.numa_node = pdev->dev.numa_node;
> +
> +	bars = pci_select_bars(pdev, IORESOURCE_MEM);
> +	err = pci_request_selected_regions(pdev, bars, DRV_MODULE_NAME);
> +	if (bars != ERDMA_BAR_MASK || err) {
> +		err = err == 0 ? -EINVAL : err;

Consider using "err = err ? err : -EINVAL;"?

Thanks,
Wenpeng



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux