diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2020-12-23 18:22:12 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2020-12-25 09:11:46 +0100 |
commit | afcfbcb39fe539ff9a24ca9187bb49e09a14abe5 (patch) | |
tree | d28441bb4559bbcb327b358407b67bef0f637567 /sound/core/seq | |
parent | ALSA: usb-audio: Fix UBSAN warnings for MIDI jacks (diff) | |
download | linux-afcfbcb39fe539ff9a24ca9187bb49e09a14abe5.tar.xz linux-afcfbcb39fe539ff9a24ca9187bb49e09a14abe5.zip |
ALSA: core: Use DIV_ROUND_UP() instead of open-coding it
Use DIV_ROUND_UP() instead of open-coding it. This documents intent
and makes it more clear what is going on for the casual reviewer.
Generated using the following the Coccinelle semantic patch.
// <smpl>
@@
expression x, y;
@@
-(((x) + (y) - 1) / (y))
+DIV_ROUND_UP(x, y)
// </smpl>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20201223172229.781-1-lars@metafoo.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/seq')
-rw-r--r-- | sound/core/seq/seq_memory.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c index 65db1a7c77b7..e245bb6ba533 100644 --- a/sound/core/seq/seq_memory.c +++ b/sound/core/seq/seq_memory.c @@ -290,7 +290,7 @@ int snd_seq_event_dup(struct snd_seq_pool *pool, struct snd_seq_event *event, extlen = 0; if (snd_seq_ev_is_variable(event)) { extlen = event->data.ext.len & ~SNDRV_SEQ_EXT_MASK; - ncells = (extlen + sizeof(struct snd_seq_event) - 1) / sizeof(struct snd_seq_event); + ncells = DIV_ROUND_UP(extlen, sizeof(struct snd_seq_event)); } if (ncells >= pool->total_elements) return -ENOMEM; |