* [patch] char: xilinx_hwicap: missing error code if ioremap() fails
@ 2014-06-11 6:04 Dan Carpenter
2014-06-11 6:40 ` Jingoo Han
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2014-06-11 6:04 UTC (permalink / raw)
To: linux-arm-kernel
Return -ENOMEM instead of success if ioremap() fails.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Static checker stuff, I can't compile this.
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index f6345f9..9b1a5ac 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
@@ -661,6 +661,7 @@ static int hwicap_setup(struct device *dev, int id,
drvdata->base_address = ioremap(drvdata->mem_start, drvdata->mem_size);
if (!drvdata->base_address) {
dev_err(dev, "ioremap() failed\n");
+ retval = -ENOMEM;
goto failed2;
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [patch] char: xilinx_hwicap: missing error code if ioremap() fails
2014-06-11 6:04 [patch] char: xilinx_hwicap: missing error code if ioremap() fails Dan Carpenter
@ 2014-06-11 6:40 ` Jingoo Han
2014-06-17 0:53 ` Michal Simek
0 siblings, 1 reply; 5+ messages in thread
From: Jingoo Han @ 2014-06-11 6:40 UTC (permalink / raw)
To: linux-arm-kernel
On Wednesday, June 11, 2014 3:05 PM, Dan Carpenter wrote:
>
> Return -ENOMEM instead of success if ioremap() fails.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Jingoo Han <jg1.han@samsung.com>
Best regards,
Jingoo Han
> ---
> Static checker stuff, I can't compile this.
>
> diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> index f6345f9..9b1a5ac 100644
> --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> @@ -661,6 +661,7 @@ static int hwicap_setup(struct device *dev, int id,
> drvdata->base_address = ioremap(drvdata->mem_start, drvdata->mem_size);
> if (!drvdata->base_address) {
> dev_err(dev, "ioremap() failed\n");
> + retval = -ENOMEM;
> goto failed2;
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [patch] char: xilinx_hwicap: missing error code if ioremap() fails
2014-06-11 6:40 ` Jingoo Han
@ 2014-06-17 0:53 ` Michal Simek
2014-06-17 6:03 ` Dan Carpenter
0 siblings, 1 reply; 5+ messages in thread
From: Michal Simek @ 2014-06-17 0:53 UTC (permalink / raw)
To: linux-arm-kernel
On 06/11/2014 08:40 AM, Jingoo Han wrote:
> On Wednesday, June 11, 2014 3:05 PM, Dan Carpenter wrote:
>>
>> Return -ENOMEM instead of success if ioremap() fails.
>>
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> Reviewed-by: Jingoo Han <jg1.han@samsung.com>
>
> Best regards,
> Jingoo Han
>
>> ---
>> Static checker stuff, I can't compile this.
>>
>> diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
>> index f6345f9..9b1a5ac 100644
>> --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
>> +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
>> @@ -661,6 +661,7 @@ static int hwicap_setup(struct device *dev, int id,
>> drvdata->base_address = ioremap(drvdata->mem_start, drvdata->mem_size);
>> if (!drvdata->base_address) {
>> dev_err(dev, "ioremap() failed\n");
>> + retval = -ENOMEM;
Isn't it just better to do?
if (IS_ERR(drvdata->base_address)) {
...
retval = PTR_ERR(drvdata->base_address);
}
Thanks,
Michal
^ permalink raw reply [flat|nested] 5+ messages in thread
* [patch] char: xilinx_hwicap: missing error code if ioremap() fails
2014-06-17 0:53 ` Michal Simek
@ 2014-06-17 6:03 ` Dan Carpenter
2014-06-17 22:11 ` Michal Simek
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2014-06-17 6:03 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Jun 17, 2014 at 02:53:27AM +0200, Michal Simek wrote:
> On 06/11/2014 08:40 AM, Jingoo Han wrote:
> > On Wednesday, June 11, 2014 3:05 PM, Dan Carpenter wrote:
> >>
> >> Return -ENOMEM instead of success if ioremap() fails.
> >>
> >> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >
> > Reviewed-by: Jingoo Han <jg1.han@samsung.com>
> >
> > Best regards,
> > Jingoo Han
> >
> >> ---
> >> Static checker stuff, I can't compile this.
> >>
> >> diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> >> index f6345f9..9b1a5ac 100644
> >> --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> >> +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> >> @@ -661,6 +661,7 @@ static int hwicap_setup(struct device *dev, int id,
> >> drvdata->base_address = ioremap(drvdata->mem_start, drvdata->mem_size);
> >> if (!drvdata->base_address) {
> >> dev_err(dev, "ioremap() failed\n");
> >> + retval = -ENOMEM;
>
> Isn't it just better to do?
>
> if (IS_ERR(drvdata->base_address)) {
> ...
> retval = PTR_ERR(drvdata->base_address);
> }
ioremap() returns NULL on error, not an ERR_PTR.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* [patch] char: xilinx_hwicap: missing error code if ioremap() fails
2014-06-17 6:03 ` Dan Carpenter
@ 2014-06-17 22:11 ` Michal Simek
0 siblings, 0 replies; 5+ messages in thread
From: Michal Simek @ 2014-06-17 22:11 UTC (permalink / raw)
To: linux-arm-kernel
On 06/17/2014 08:03 AM, Dan Carpenter wrote:
> On Tue, Jun 17, 2014 at 02:53:27AM +0200, Michal Simek wrote:
>> On 06/11/2014 08:40 AM, Jingoo Han wrote:
>>> On Wednesday, June 11, 2014 3:05 PM, Dan Carpenter wrote:
>>>>
>>>> Return -ENOMEM instead of success if ioremap() fails.
>>>>
>>>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>>>
>>> Reviewed-by: Jingoo Han <jg1.han@samsung.com>
>>>
>>> Best regards,
>>> Jingoo Han
>>>
>>>> ---
>>>> Static checker stuff, I can't compile this.
>>>>
>>>> diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
>>>> index f6345f9..9b1a5ac 100644
>>>> --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
>>>> +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
>>>> @@ -661,6 +661,7 @@ static int hwicap_setup(struct device *dev, int id,
>>>> drvdata->base_address = ioremap(drvdata->mem_start, drvdata->mem_size);
>>>> if (!drvdata->base_address) {
>>>> dev_err(dev, "ioremap() failed\n");
>>>> + retval = -ENOMEM;
>>
>> Isn't it just better to do?
>>
>> if (IS_ERR(drvdata->base_address)) {
>> ...
>> retval = PTR_ERR(drvdata->base_address);
>> }
>
> ioremap() returns NULL on error, not an ERR_PTR.
Ah ok. Fair enough.
Thanks,
Michal
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-06-17 22:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-11 6:04 [patch] char: xilinx_hwicap: missing error code if ioremap() fails Dan Carpenter
2014-06-11 6:40 ` Jingoo Han
2014-06-17 0:53 ` Michal Simek
2014-06-17 6:03 ` Dan Carpenter
2014-06-17 22:11 ` Michal Simek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).