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: <5045F13B.8060409@mvista.com>
Date:	Tue, 04 Sep 2012 16:16:59 +0400
From:	Sergei Shtylyov <sshtylyov@...sta.com>
To:	Andi Shyti <andi@...zian.org>
CC:	Dong Aisheng <b29396@...escale.com>, linus.walleij@...ricsson.com,
	swarren@...dotorg.org, devicetree-discuss@...ts.ozlabs.org,
	s.hauer@...gutronix.de, broonie@...nsource.wolfsonmicro.com,
	linux-kernel@...r.kernel.org, rob.herring@...xeda.com,
	grant.likely@...retlab.ca, richard.zhao@...escale.com,
	kernel@...gutronix.de, shawn.guo@...aro.org, lrg@...com,
	linux-arm-kernel@...ts.infradead.org, sameo@...ux.intel.com
Subject: Re: [PATCH v5 1/4] mfd: add syscon driver based on regmap

Hello.

On 04-09-2012 15:35, Andi Shyti wrote:

>> +static int __devinit syscon_probe(struct platform_device *pdev)
>> +{
>> +	struct device *dev = &pdev->dev;

> Do we really need this variable? Anyway you are using it only
> once in the dev_info.

    But Dong definitely could use it more than once, so it seems useful.

>> +	struct device_node *np = dev->of_node;
>> +	struct syscon *syscon;
>> +	struct resource res;
>> +	int ret;
>> +
>> +	if (!np)
>> +		return -ENOENT;
>> +
>> +	syscon = devm_kzalloc(&pdev->dev, sizeof(struct syscon),
>> +			    GFP_KERNEL);
>> +	if (!syscon)
>> +		return -ENOMEM;
>> +
>> +	syscon->base = of_iomap(np, 0);
>> +	if (!syscon->base)
>> +		return -EADDRNOTAVAIL;
>> +
>> +	ret = of_address_to_resource(np, 0, &res);
>> +	if (ret)
>> +		return ret;
>> +
>> +	syscon_regmap_config.max_register = res.end - res.start - 3;
>> +	syscon->regmap = devm_regmap_init_mmio(&pdev->dev, syscon->base,
>> +					&syscon_regmap_config);
>> +	if (IS_ERR(syscon->regmap)) {
>> +		dev_err(&pdev->dev, "regmap init failed\n");
>> +		return PTR_ERR(syscon->regmap);
>> +	}
>> +
>> +	syscon->dev = &pdev->dev;
>> +	platform_set_drvdata(pdev, syscon);
>> +
>> +	dev_info(dev, "syscon regmap start 0x%x end 0x%x registered\n",
>> +		res.start, res.end);
>> +
>> +	return 0;

> in case of error you are not freeing syscon.

    It's allocated using devm_kzalloc(), so is freed automaticelly upon probe 
error.

> Moreover, in my opinion, some dev_err more should not heart

    Hurt, you mean?

> Andi

WBR, Sergei

--
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