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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2E89032DDAA8B9408CB92943514A0337AB529E6E@SW-EX-MBX01.diasemi.com>
Date:	Tue, 27 Jan 2015 16:16:31 +0000
From:	"Opensource [Adam Thomson]" <Adam.Thomson.Opensource@...semi.com>
To:	Varka Bhadram <varkabhadram@...il.com>,
	"Opensource [Adam Thomson]" <Adam.Thomson.Opensource@...semi.com>,
	Lee Jones <lee.jones@...aro.org>,
	Samuel Ortiz <sameo@...ux.intel.com>,
	Jonathan Cameron <jic23@...nel.org>,
	Hartmut Knaack <knaack.h@....de>,
	"linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
	Sebastian Reichel <sre@...nel.org>,
	"Dmitry Eremin-Solenikov" <dbaryshkov@...il.com>,
	David Woodhouse <dwmw2@...radead.org>,
	"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
	Rob Herring <robh+dt@...nel.org>,
	Pawel Moll <pawel.moll@....com>,
	"Mark Rutland" <mark.rutland@....com>,
	Ian Campbell <ijc+devicetree@...lion.org.uk>,
	Kumar Gala <galak@...eaurora.org>,
	Grant Likely <grant.likely@...aro.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Joe Perches <joe@...ches.com>
CC:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"Support Opensource" <Support.Opensource@...semi.com>
Subject: RE: [PATCH v6 5/7] power: Add support for DA9150 Charger

On January 21, 2015 16:15, Varka Bhadram wrote:

> On Wednesday 21 January 2015 09:16 PM, Adam Thomson wrote:
> > This patch adds support for DA9150 Charger & Fuel-Gauge IC Charger.
> >
> > Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@...semi.com>
> > ---
> 
> (...)
> 
> > +static int da9150_charger_register_irq(struct platform_device *pdev,
> > +				       irq_handler_t handler,
> > +				       const char *irq_name)
> > +{
> > +	struct device *dev = &pdev->dev;
> > +	struct da9150_charger *charger = platform_get_drvdata(pdev);
> > +	int irq, ret;
> > +
> > +	irq = platform_get_irq_byname(pdev, irq_name);
> > +	if (irq < 0) {
> > +		dev_err(dev, "Failed to get IRQ CHG_STATUS: %d\n", irq);
> > +		return irq;
> > +	}
> > +
> > +	ret = request_threaded_irq(irq, NULL, handler, IRQF_ONESHOT, irq_name,
> > +				   charger);
> 
> Why don you use devm_* API..?

As mentioned in previous discussions, the order of tidy up is important so 
devm_* functions cannot be used here.

> 
> > +	if (ret)
> > +		dev_err(dev, "Failed to request IRQ %d: %d\n", irq, ret);
> > +
> > +	return ret;
> > +}
> > +
> > +static void da9150_charger_unregister_irq(struct platform_device *pdev,
> > +					  const char *irq_name)
> > +{
> > +	struct device *dev = &pdev->dev;
> > +	struct da9150_charger *charger = platform_get_drvdata(pdev);
> > +	int irq;
> > +
> > +	irq = platform_get_irq_byname(pdev, irq_name);
> > +	if (irq < 0) {
> > +		dev_err(dev, "Failed to get IRQ CHG_STATUS: %d\n", irq);
> > +		return;
> > +	}
> > +
> > +	free_irq(irq, charger);
> > +}
> > +
> > +static int da9150_charger_probe(struct platform_device *pdev)
> > +{
> > +	struct device *dev = &pdev->dev;
> > +	struct da9150 *da9150 = dev_get_drvdata(dev->parent);
> > +	struct da9150_charger *charger;
> > +	struct power_supply *usb, *battery;
> > +	u8 reg;
> > +	int ret;
> > +
> > +	charger = devm_kzalloc(dev, sizeof(struct da9150_charger), GFP_KERNEL);
> > +	if (charger == NULL)
> > +		return -ENOMEM;
> 
> sizeof(struct da9150_charger) can be replaced with sizeof(*charger)...
> 
> *!* operator can be used in comparison with NULL...
> 

Yes, but functionally no different. Can maybe change this around later, but
would like to avoid changing current patch set right now.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ