Re: [PATCH -next 9/9] ASoC: fsl_xcvr: check return value after calling platform_get_resource_byname()

From: Timur Tabi
Date: Sun Jun 13 2021 - 10:01:29 EST


On Fri, Jun 11, 2021 at 4:32 AM Yang Yingliang <yangyingliang@xxxxxxxxxx> wrote:

> rx_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rxfifo");
> tx_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "txfifo");
> + if (!rx_res || !tx_res) {
> + dev_err(dev, "Invalid resource\n");
> + return -EINVAL;
> + }

If platform_get_resource_byname() returns an error, it's probably
because the name cannot be found. So I think this error message is
more accurate:

"could not find rxfifo or txfifo resource"