[dpdk-dev] [PATCH 01/10] net/pfe: check return value

Stephen Hemminger stephen at networkplumber.org
Fri Jun 30 19:59:16 CEST 2023


On Mon, 19 Apr 2021 21:34:40 +0800
"Min Hu (Connor)" <humin29 at huawei.com> wrote:

>  
>  	fd = open("/dev/mem", O_RDWR);
> +	if (fd < 0) {
> +		PFE_PMD_ERR("Can not open /dev/mem");
> +		rc = -EIO;
> +		goto err;
> +	}
> +

This patch makes sense and should be applied.
But the errno is most like EPERM so maybe:
	rc = -errno;

PS: /dev/mem is a bad idea, Linux kernel config often disables
it in distributions. Not sure why this driver can't use UIO or VFIO
like normal devices. This should have been caught during code review.


More information about the dev mailing list