[...] >> >> diff --git a/drivers/iio/temperature/maxim_thermocouple.c b/drivers/iio/temperature/maxim_thermocouple.c >> index 39dd202..01cad6e 100644 >> --- a/drivers/iio/temperature/maxim_thermocouple.c >> +++ b/drivers/iio/temperature/maxim_thermocouple.c >> @@ -123,22 +123,24 @@ static int maxim_thermocouple_read(struct maxim_thermocouple_data *data, >> { >> unsigned int storage_bytes = data->chip->read_size; >> unsigned int shift = chan->scan_type.shift + (chan->address * 8); >> - unsigned int buf; >> + __be16 buf1; >> + __be32 buf2; >> int ret; >> >> - ret = spi_read(data->spi, (void *) &buf, storage_bytes); >> - if (ret) >> - return ret; >> - >> switch (storage_bytes) { >> case 2: >> - *val = be16_to_cpu(buf); >> + ret = spi_read(data->spi, (void *)&buf1, storage_bytes); >> + *val = be16_to_cpu(buf1); > > Meh don't really like having buf1, and buf2 esp since they only used > in one branch of the switch statement. And waste 2-4 byte of stack :). > > I recommend something like: > > case 2: { > __be16 buf; > ret = spi_read(data->spi, (void *)&buf1, storage_bytes); > *val = be16_to_cpu(buf1); > break; > } > case 4: > .... > I'd be quite surprised if the compiled end result actually looks different between this and the original patch. Compilers are quite smart these days. I wouldn't worry too much about it and keep the original solution, since it has a nicer code flow to it. -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html