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] [day] [month] [year] [list]
Date:	Tue, 22 Apr 2014 10:41:34 +0200
From:	Krzysztof Kozlowski <k.kozlowski@...sung.com>
To:	Lee Jones <lee.jones@...aro.org>
Cc:	Sangbeom Kim <sbkim73@...sung.com>,
	Samuel Ortiz <sameo@...ux.intel.com>,
	linux-kernel@...r.kernel.org,
	Kyungmin Park <kyungmin.park@...sung.com>,
	Marek Szyprowski <m.szyprowski@...sung.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
Subject: Re: [PATCH 1/2] mfd: sec-core: Remove duplicated device type from
 sec_pmic

On wto, 2014-04-22 at 09:09 +0100, Lee Jones wrote:
> > > > +	unsigned long device_type;
> > > >  	int ret;
> > > >  
> > > >  	sec_pmic = devm_kzalloc(&i2c->dev, sizeof(struct sec_pmic_dev),
> > > > @@ -262,7 +263,7 @@ static int sec_pmic_probe(struct i2c_client *i2c,
> > > >  	sec_pmic->dev = &i2c->dev;
> > > >  	sec_pmic->i2c = i2c;
> > > >  	sec_pmic->irq = i2c->irq;
> > > > -	sec_pmic->type = sec_i2c_get_driver_data(i2c, id);
> > > > +	device_type = sec_i2c_get_driver_data(i2c, id);
> > > 
> > > Better to change the return type of 'sec_i2c_get_driver_data()' than
> > > to rely on a cast later on.
> > 
> > Hmmm... it was like that before Pankaj Dubey change (8f695de515b9).
> > Solving that issue (-Wpointer-to-int-cast) along with keeping 'int' as
> > return type of sec_i2c_get_driver_data would lead to one of:
> > 1. Using temporary variable in ec_i2c_get_driver_data just for cast.
> > 
> > static inline int sec_i2c_get_driver_data(struct i2c_client *i2c,
> > 						const struct i2c_device_id *id)
> > {
> > 	unsigned long type;
> > 
> > 	if (i2c->dev.of_node) {
> > 		const struct of_device_id *match;
> > 		match = of_match_node(sec_dt_match, i2c->dev.of_node);
> > 		type = (unsigned long)match->data;
> > 	}
> > 	type = id->driver_data;
> > 
> > 	return (int)type;
> > }
> > 
> > or
> > 2. Double cast: (int)(unsigned long)match->data;
> > 
> > For me both are kind a ugly... What do you think?
> 
> I'm saying, why don't you change everything; the return value of
> sec_i2c_get_driver_data(), pdata->device_type and device_type to long
> or unsigned long? Then the only cast you need to do is from void*.

Aaaa, I got it. I'll sent next version of patch.

Best regards,
Krzysztof


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