Re: [PATCH] staging: greybus: power_supply: Use struct_size() helper

2019-04-10 Thread Gustavo A. R. Silva
Johan, On 4/4/19 2:24 AM, Johan Hovold wrote: > On Thu, Apr 04, 2019 at 08:09:51AM +0100, Rui Miguel Silva wrote: >> Hi Gustavo, >> Thanks a lot for the patch. >> >> On Wed 03 Apr 2019 at 21:58, Gustavo A. R. Silva wrote: >>> Make use of the struct_size() helper instead of an open-coded >>>

Re: [PATCH] staging: greybus: power_supply: Use struct_size() helper

2019-04-10 Thread Gustavo A. R. Silva
Hi Johan, On 4/4/19 1:57 AM, Johan Hovold wrote: > > This patch looks good, but I noticed a bug here in the current code, > which should be fixed before applying this clean up. > > sizeof(req) should have been sizeof(*req) above. > Good catch. >> - sizeof(struct

Re: [PATCH] staging: greybus: power_supply: Use struct_size() helper

2019-04-04 Thread Johan Hovold
On Thu, Apr 04, 2019 at 08:09:51AM +0100, Rui Miguel Silva wrote: > Hi Gustavo, > Thanks a lot for the patch. > > On Wed 03 Apr 2019 at 21:58, Gustavo A. R. Silva wrote: > > Make use of the struct_size() helper instead of an open-coded > > version > > in order to avoid any potential type

Re: [PATCH] staging: greybus: power_supply: Use struct_size() helper

2019-04-04 Thread Rui Miguel Silva
Hi Gustavo, Thanks a lot for the patch. On Wed 03 Apr 2019 at 21:58, Gustavo A. R. Silva wrote: Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes, in particular in the context in which this code is being used. So, replace code

Re: [PATCH] staging: greybus: power_supply: Use struct_size() helper

2019-04-04 Thread Johan Hovold
On Wed, Apr 03, 2019 at 03:58:01PM -0500, Gustavo A. R. Silva wrote: > Make use of the struct_size() helper instead of an open-coded version > in order to avoid any potential type mistakes, in particular in the > context in which this code is being used. > > So, replace code of the following

[PATCH] staging: greybus: power_supply: Use struct_size() helper

2019-04-03 Thread Gustavo A. R. Silva
Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes, in particular in the context in which this code is being used. So, replace code of the following form: sizeof(*resp) + props_count * sizeof(struct gb_power_supply_props_desc)