Use values from "locators.h" when constructing locators array to be sure
of correct index;
This commit is contained in:
parent
39d0249096
commit
a28a80c94c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: i2c.c,v 1.52 2016/06/07 01:06:27 pgoyette Exp $ */
|
||||
/* $NetBSD: i2c.c,v 1.53 2016/07/23 17:42:37 jakllsch Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003 Wasabi Systems, Inc.
|
||||
|
@ -40,7 +40,7 @@
|
|||
#endif
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.52 2016/06/07 01:06:27 pgoyette Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.53 2016/07/23 17:42:37 jakllsch Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -236,7 +236,7 @@ iic_attach(device_t parent, device_t self, void *aux)
|
|||
uint64_t cookie;
|
||||
const char *name;
|
||||
struct i2c_attach_args ia;
|
||||
int loc[2];
|
||||
int loc[IICCF_NLOCS];
|
||||
|
||||
memset(loc, 0, sizeof loc);
|
||||
count = prop_array_count(child_devices);
|
||||
|
@ -250,11 +250,11 @@ iic_attach(device_t parent, device_t self, void *aux)
|
|||
continue;
|
||||
if (!prop_dictionary_get_uint64(dev, "cookie", &cookie))
|
||||
cookie = 0;
|
||||
loc[0] = addr;
|
||||
loc[IICCF_ADDR] = addr;
|
||||
if (prop_dictionary_get_uint32(dev, "size", &size))
|
||||
loc[1] = size;
|
||||
loc[IICCF_SIZE] = size;
|
||||
else
|
||||
loc[1] = -1;
|
||||
loc[IICCF_SIZE] = -1;
|
||||
|
||||
memset(&ia, 0, sizeof ia);
|
||||
ia.ia_addr = addr;
|
||||
|
|
Loading…
Reference in New Issue