Re: [PATCH] i2c: avoid dynamic stack use in dm_i2c_write

2022-07-19 Thread Heiko Schocher
Hello Rasmus, On 07.07.22 15:12, Rasmus Villemoes wrote: > The size of the dynamic stack allocation here is bounded by the if() > statement. However, just allocating the maximum size up-front and > doing malloc() if necessary avoids code duplication (the > i2c_setup_offset() until the invocation

Re: [PATCH] i2c: avoid dynamic stack use in dm_i2c_write

2022-07-10 Thread Heiko Schocher
Hello Rasmus, On 07.07.22 15:12, Rasmus Villemoes wrote: > The size of the dynamic stack allocation here is bounded by the if() > statement. However, just allocating the maximum size up-front and > doing malloc() if necessary avoids code duplication (the > i2c_setup_offset() until the invocation

[PATCH] i2c: avoid dynamic stack use in dm_i2c_write

2022-07-07 Thread Rasmus Villemoes
The size of the dynamic stack allocation here is bounded by the if() statement. However, just allocating the maximum size up-front and doing malloc() if necessary avoids code duplication (the i2c_setup_offset() until the invocation of ->xfer), and generates much better (smaller) code: