Input: initialize device counter variables with -1
Let's initialize atomic_t variables keeping track of number of various devices created so far with -1 in order to avoid extra subtraction operation. Signed-off-by: Aniroop Mathur <aniroop.mathur@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:

committed by
Dmitry Torokhov

parent
9c7d66fa9b
commit
939ffb1712
@@ -1851,7 +1851,7 @@ static int ims_pcu_identify_type(struct ims_pcu *pcu, u8 *device_id)
|
||||
|
||||
static int ims_pcu_init_application_mode(struct ims_pcu *pcu)
|
||||
{
|
||||
static atomic_t device_no = ATOMIC_INIT(0);
|
||||
static atomic_t device_no = ATOMIC_INIT(-1);
|
||||
|
||||
const struct ims_pcu_device_info *info;
|
||||
int error;
|
||||
@@ -1882,7 +1882,7 @@ static int ims_pcu_init_application_mode(struct ims_pcu *pcu)
|
||||
}
|
||||
|
||||
/* Device appears to be operable, complete initialization */
|
||||
pcu->device_no = atomic_inc_return(&device_no) - 1;
|
||||
pcu->device_no = atomic_inc_return(&device_no);
|
||||
|
||||
/*
|
||||
* PCU-B devices, both GEN_1 and GEN_2 do not have OFN sensor
|
||||
|
Reference in New Issue
Block a user