In cx24227_writereg() / cx24227_readreg(), return the error

from iic_acquire_bus(), not some bogus return value that can
potentially be confused for a real error code.
This commit is contained in:
thorpej 2019-12-23 18:03:14 +00:00
parent 030d4fb522
commit 721b6ed7c4
1 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cx24227.c,v 1.8 2017/06/01 02:45:10 chs Exp $ */
/* $NetBSD: cx24227.c,v 1.9 2019/12/23 18:03:14 thorpej Exp $ */
/*
* Copyright (c) 2008, 2011 Jonathan A. Kollasch
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cx24227.c,v 1.8 2017/06/01 02:45:10 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: cx24227.c,v 1.9 2019/12/23 18:03:14 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -108,8 +108,8 @@ cx24227_writereg(struct cx24227 *sc, uint8_t reg, uint16_t data)
int error;
uint8_t r[3];
if (iic_acquire_bus(sc->tag, I2C_F_POLL) != 0)
return false;
if ((error = iic_acquire_bus(sc->tag, I2C_F_POLL) != 0))
return error;
r[0] = reg;
r[1] = (data >> 8) & 0xff;
@ -130,8 +130,8 @@ cx24227_readreg(struct cx24227 *sc, uint8_t reg, uint16_t *data)
*data = 0x0000;
if (iic_acquire_bus(sc->tag, I2C_F_POLL) != 0)
return -1;
if ((error = iic_acquire_bus(sc->tag, I2C_F_POLL) != 0))
return error;
error = iic_exec(sc->tag, I2C_OP_READ_WITH_STOP, sc->addr,
&reg, 1, r, 2, I2C_F_POLL);