lkml.org 
[lkml]   [2016]   [Dec]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [v1] i2c: busses: i2c-designware-pcidrv:- Handle return NULL error from pcim_iomap_table
From
Date
Yes, It will not fail. Sorry for the noise.

Thanks
-Arvind

On Thursday 22 December 2016 08:05 PM, Andy Shevchenko wrote:
> On Thu, 2016-12-22 at 17:09 +0530, Arvind Yadav wrote:
>> Here, If pcim_iomap_table will fail. It will return NULL.
>> Kernel can run into a NULL-pointer dereference.
>> This error check will avoid NULL pointer dereference.
>>
>> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
>> ---
>> drivers/i2c/busses/i2c-designware-pcidrv.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c
>> b/drivers/i2c/busses/i2c-designware-pcidrv.c
>> index d6423cf..6a1907d 100644
>> --- a/drivers/i2c/busses/i2c-designware-pcidrv.c
>> +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
>> @@ -235,6 +235,10 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
>> dev->controller = controller;
>> dev->get_clk_rate_khz = i2c_dw_get_clk_rate_khz;
>> dev->base = pcim_iomap_table(pdev)[0];
>> + if (!dev->base) {
>> + dev_err(&pdev->dev, "I/O map table allocation
>> failed\n");
>> + return -ENOMEM;
>> + }
> NAK.
>
>

\
 
 \ /
  Last update: 2016-12-22 18:12    [W:0.054 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site