lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 09 Sep 2010 14:52:19 -0600
From:	Kenneth Heitke <kheitke@...eaurora.org>
To:	Sundar <sunder.svit@...il.com>
CC:	khali@...ux-fr.org, ben-linux@...ff.org,
	srinidhi.kasagar@...ricsson.com, tsoni@...eaurora.org,
	linus.walleij@...ricsson.com, linux-arm-msm@...r.kernel.org,
	arve@...roid.com, swetland@...gle.com, sdharia@...eaurora.com,
	David Brown <davidb@...eaurora.org>,
	Daniel Walker <dwalker@...eaurora.org>,
	Bryan Huntsman <bryanh@...eaurora.org>,
	Russell King <linux@....linux.org.uk>,
	Crane Cai <crane.cai@....com>,
	Samuel Ortiz <sameo@...ux.intel.com>,
	Ralf Baechle <ralf@...ux-mips.org>,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	linux-i2c@...r.kernel.org
Subject: Re: [PATCH v3] i2c: QUP based bus driver for Qualcomm MSM chipsets

Sundar wrote:
> Hi Kenneth,
> 
> just some error codes and leaks if I am right :)
> 
> On Wed, Sep 8, 2010 at 6:29 AM, Kenneth Heitke <kheitke@...eaurora.org> wrote:
>> +
>> +static int __devinit
>> +qup_i2c_probe(struct platform_device *pdev)
>> +{
>> +
>> +       qup_mem = platform_get_resource_byname(pdev, IORESOURCE_MEM,
>> +                                               "qup_phys_addr");
>> +       if (!qup_mem) {
>> +               dev_err(&pdev->dev, "no qup mem resource?\n");
>> +               return -ENODEV;
> 
> I think this should be -ENXIO instead of -ENODEV?
> 
>> +       gsbi_mem = platform_get_resource_byname(pdev, IORESOURCE_MEM,
>> +                                               "gsbi_qup_i2c_addr");
>> +       if (!gsbi_mem) {
>> +               dev_err(&pdev->dev, "no gsbi mem resource?\n");
>> +               return -ENODEV;
> 
> Ditto here.
> 
>> +       in_irq = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
>> +                                               "qup_in_intr");
>> +
>> +       out_irq = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
>> +                                               "qup_out_intr");
>> +
>> +       err_irq = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
>> +                                               "qup_err_intr");
>> +       if (!err_irq) {
>> +               dev_err(&pdev->dev, "no error irq resource?\n");
>> +               return -ENODEV;
>> +       }
> 
> All the same here too?
> 
>> +
>> +       qup_io = devm_request_mem_region(&pdev->dev, qup_mem->start,
>> +                       resource_size(qup_mem), pdev->name);
>> +       if (!qup_io) {
>> +               dev_err(&pdev->dev, "QUP region already claimed\n");
>> +               return -EBUSY;
>> +       }
>> +
>> +       gsbi_io = devm_request_mem_region(&pdev->dev, gsbi_mem->start,
>> +                       resource_size(gsbi_mem), pdev->name);
>> +       if (!gsbi_io) {
>> +               dev_err(&pdev->dev, "GSBI region already claimed\n");
>> +               return -EBUSY;
>> +       }
>> +
>> +       dev = devm_kzalloc(&pdev->dev, sizeof(struct qup_i2c_dev), GFP_KERNEL);
> 
> [..]
> 
>> +       if (!dev->base)
>> +               return -ENOMEM;
> 
> Missing *_kzfree whilst returning?
> 
>> +       dev->gsbi = devm_ioremap(&pdev->dev,
>> +                       gsbi_mem->start, resource_size(gsbi_mem));
>> +       if (!dev->gsbi)
>> +               return -ENOMEM;
>> +
>> +       clk = clk_get(&pdev->dev, "qup_clk");
>> +       if (IS_ERR(clk)) {
>> +               dev_err(&pdev->dev, "Could not get clock\n");
>> +               ret = PTR_ERR(clk);
>> +               goto err_clk_get_failed;
> 
> Will not the devm_iounmap be needed here?
> 
> Thanx!
> Sundar
> 

Hopefully no leaks since I am using the devm_ calls.  The resources 
should be freed up automatically on device release and if the probe 
function fails.  Please let me know if this assumption is not correct.

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ