mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
dm space map metadata: use ARRAY_SIZE
Using the ARRAY_SIZE macro improves the readability of the code. Found with Coccinelle with the following semantic patch: @r depends on (org || report)@ type T; T[] E; position p; @@ ( (sizeof(E)@p /sizeof(*E)) | (sizeof(E)@p /sizeof(E[...])) | (sizeof(E)@p /sizeof(T)) ) Signed-off-by: Jérémy Lefaure <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
This commit is contained in:
parent
98d82f48f1
commit
fbc61291d7
1 changed files with 2 additions and 1 deletions
|
|
@ -11,6 +11,7 @@
|
|||
#include <linux/list.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/device-mapper.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
#define DM_MSG_PREFIX "space map metadata"
|
||||
|
||||
|
|
@ -111,7 +112,7 @@ static bool brb_empty(struct bop_ring_buffer *brb)
|
|||
static unsigned brb_next(struct bop_ring_buffer *brb, unsigned old)
|
||||
{
|
||||
unsigned r = old + 1;
|
||||
return (r >= (sizeof(brb->bops) / sizeof(*brb->bops))) ? 0 : r;
|
||||
return r >= ARRAY_SIZE(brb->bops) ? 0 : r;
|
||||
}
|
||||
|
||||
static int brb_push(struct bop_ring_buffer *brb,
|
||||
|
|
|
|||
Loading…
Reference in a new issue