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]
Date:   Wed, 2 Aug 2017 23:19:52 +0200
From:   Peter Rosin <peda@...ntia.se>
To:     Stephen Warren <swarren@...dotorg.org>
Cc:     linux-kernel@...r.kernel.org, Wolfram Sang <wsa@...-dreams.de>,
        Stephen Warren <swarren@...dia.com>, linux-i2c@...r.kernel.org
Subject: Re: [PATCH 1/2] i2c: mux: pinctrl: remove platform_data

On 2017-08-02 21:05, Stephen Warren wrote:
> On 08/02/2017 01:27 AM, Peter Rosin wrote:
>> No platform (at least no upstreamed platform) has ever used this
>> platform_data. Just drop it and simplify the code.
> 
>> diff --git a/drivers/i2c/muxes/i2c-mux-pinctrl.c b/drivers/i2c/muxes/i2c-mux-pinctrl.c
> 
>>   static int i2c_mux_pinctrl_probe(struct platform_device *pdev)
> 
> (eliding some - lines for brevity in the following):
> 
>> +	for (i = 0; i < num_names; i++) {
>> +		ret = of_property_read_string_index(np, "pinctrl-names", i,
>> +						    &name);
>> +		if (ret < 0) {
>> +			dev_err(dev, "Cannot parse pinctrl-names: %d\n", ret);
>> +			goto err_put_parent;
>> +		}
>> +
>> +		mux->states[i] = pinctrl_lookup_state(mux->pinctrl, name);
>>   		if (IS_ERR(mux->states[i])) {
>>   			ret = PTR_ERR(mux->states[i]);
>> +			dev_err(dev, "Cannot look up pinctrl state %s: %d\n",
>> +				name, ret);
>> +			goto err_put_parent;
> 
> This error path doesn't undo pinctrl_lookup_state. Is that OK? I think 
> so, but wanted to check.

I also think so, looking at pinctrl_lookup_state, it seems to just match
strings and return a pointer. No refcounts or other state change involved
that I can see. Either way, the preexisting code would have the same issue
so it would be orthogonal and fodder for another patch...

>> +	muxc = i2c_mux_alloc(parent, dev, num_names,
>> +			     sizeof(*mux) + num_names * sizeof(*mux->states),
>> +			     0, i2c_mux_pinctrl_select, NULL);
> ...
>> +	/* Do not add any adapter for the idle state (if it's there at all). */
>> +	for (i = 0; i < num_names - !!mux->state_idle; i++) {
>> +		ret = i2c_mux_add_adapter(muxc, 0, i, 0);
> 
> Is it OK to potentially add one fewer adapter here than the child bus 
> count passed to i2c_mux_alloc() earlier? The old code specifically 
> excluded the idle state (if present) from the child bus count passed to 
> i2c_mux_alloc(), which was aided by the fact that it parsed the DT 
> before calling i2c_mux_alloc().

Yes, that is perfectly fine. The only issue is wasting space for one extra
pointer.

> If those two things are OK, then:
> Reviewed-by: Stephen Warren <swarren@...dia.com>

Thanks!

Cheers,
Peter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ