[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220113080206.1198250-1-jiasheng@iscas.ac.cn>
Date: Thu, 13 Jan 2022 16:02:06 +0800
From: Jiasheng Jiang <jiasheng@...as.ac.cn>
To: jirislaby@...nel.org, gregkh@...uxfoundation.org
Cc: linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org,
Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: Re: Re: [PATCH] tty/serial: Check for null pointer after calling devm_ioremap
On Thu, Jan 13, 2022 at 03:35:14PM +0800, Jiri Slaby wrote:
>> diff --git a/drivers/tty/serial/milbeaut_usio.c b/drivers/tty/serial/milbeaut_usio.c
>> index 8f2cab7f66ad..1ecbf6d0dc79 100644
>> --- a/drivers/tty/serial/milbeaut_usio.c
>> +++ b/drivers/tty/serial/milbeaut_usio.c
>> @@ -523,6 +523,10 @@ static int mlb_usio_probe(struct platform_device *pdev)
>> }
>> port->membase = devm_ioremap(&pdev->dev, res->start,
>> resource_size(res));
>> + if (!port->membase) {
>> + ret = -ENOMEM;
>> + goto failed;
>> + }
>
> what about using devm_ioremap_resource() and have only one if there?
Well, I check the comment of the devm_ioremap_resource() and notice that
it checks and requests region before ioremap.
And the usage example is fit for the situation.
But I have still have no idea what the concrete advantages of the
devm_ioremap_resource(), like fixing something or improve the efficiency.
Please give me more detail.
Sincerely thanks,
Jiang
Powered by blists - more mailing lists