Re: [patch] char: xilinx_hwicap: missing error code if ioremap() fails

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

 



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@xxxxxxxxxx>
> 
> Reviewed-by: Jingoo Han <jg1.han@xxxxxxxxxxx>
> 
> 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


--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux