ols: Make use of zero-initialization.

No need to assign zero after gmalloc0(). Move comments to declaration.

Reviewed-By: Wolfram Sang <wsa@kernel.org>
This commit is contained in:
v1ne 2020-03-31 18:48:05 +02:00 committed by Gerhard Sittig
parent b54d9b4974
commit 0ccc6f7cdf
2 changed files with 2 additions and 7 deletions

View File

@ -134,14 +134,7 @@ SR_PRIV struct dev_context *ols_dev_new(void)
struct dev_context *devc;
devc = g_malloc0(sizeof(struct dev_context));
/* Device-specific settings */
devc->max_samples = devc->max_samplerate = devc->protocol_version = 0;
/* Acquisition settings */
devc->limit_samples = devc->capture_ratio = 0;
devc->trigger_at = -1;
devc->flag_reg = 0;
return devc;
}

View File

@ -67,11 +67,13 @@
#define FLAG_DEMUX (1 << 0)
struct dev_context {
/* constant device properties: */
int max_channels;
uint32_t max_samples;
uint32_t max_samplerate;
uint32_t protocol_version;
/* acquisition-related properties: */
uint64_t cur_samplerate;
uint32_t cur_samplerate_divider;
uint64_t limit_samples;