diff mbox

media: ov5640: add error trace in case of i2c read failure

Message ID 1517397564-12335-1-git-send-email-hugues.fruchet@st.com (mailing list archive)
State New, archived
Headers show

Commit Message

Hugues FRUCHET Jan. 31, 2018, 11:19 a.m. UTC
Add an error trace in ov5640_read_reg() in case of i2c_transfer()
failure.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
---
 drivers/media/i2c/ov5640.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Sakari Ailus Jan. 31, 2018, 11:57 a.m. UTC | #1
On Wed, Jan 31, 2018 at 12:19:24PM +0100, Hugues Fruchet wrote:
> Add an error trace in ov5640_read_reg() in case of i2c_transfer()
> failure.
> 
> Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
> ---
>  drivers/media/i2c/ov5640.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
> index 99a5902..882a7c3 100644
> --- a/drivers/media/i2c/ov5640.c
> +++ b/drivers/media/i2c/ov5640.c
> @@ -868,8 +868,11 @@ static int ov5640_read_reg(struct ov5640_dev *sensor, u16 reg, u8 *val)
>  	msg[1].len = 1;
>  
>  	ret = i2c_transfer(client->adapter, msg, 2);
> -	if (ret < 0)
> +	if (ret < 0) {
> +		v4l2_err(&sensor->sd, "%s: error: reg=%x\n",

The driver uses dev_ macros almost universally, how about doing the same
here?

> +			 __func__, reg);
>  		return ret;
> +	}
>  
>  	*val = buf[0];
>  	return 0;
> -- 
> 1.9.1
>
Hugues FRUCHET Jan. 31, 2018, 12:36 p.m. UTC | #2
Hi Sakari,
I've made it symetric to ov5640_write_reg() which also uses v4l2_err,
I will change both so we are gone with all v4l2_err.

BR,
Hugues.

On 01/31/2018 12:57 PM, Sakari Ailus wrote:
> On Wed, Jan 31, 2018 at 12:19:24PM +0100, Hugues Fruchet wrote:

>> Add an error trace in ov5640_read_reg() in case of i2c_transfer()

>> failure.

>>

>> Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>

>> ---

>>   drivers/media/i2c/ov5640.c | 5 ++++-

>>   1 file changed, 4 insertions(+), 1 deletion(-)

>>

>> diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c

>> index 99a5902..882a7c3 100644

>> --- a/drivers/media/i2c/ov5640.c

>> +++ b/drivers/media/i2c/ov5640.c

>> @@ -868,8 +868,11 @@ static int ov5640_read_reg(struct ov5640_dev *sensor, u16 reg, u8 *val)

>>   	msg[1].len = 1;

>>   

>>   	ret = i2c_transfer(client->adapter, msg, 2);

>> -	if (ret < 0)

>> +	if (ret < 0) {

>> +		v4l2_err(&sensor->sd, "%s: error: reg=%x\n",

> 

> The driver uses dev_ macros almost universally, how about doing the same

> here?

> 

>> +			 __func__, reg);

>>   		return ret;

>> +	}

>>   

>>   	*val = buf[0];

>>   	return 0;

>> -- 

>> 1.9.1

>>

>
diff mbox

Patch

diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
index 99a5902..882a7c3 100644
--- a/drivers/media/i2c/ov5640.c
+++ b/drivers/media/i2c/ov5640.c
@@ -868,8 +868,11 @@  static int ov5640_read_reg(struct ov5640_dev *sensor, u16 reg, u8 *val)
 	msg[1].len = 1;
 
 	ret = i2c_transfer(client->adapter, msg, 2);
-	if (ret < 0)
+	if (ret < 0) {
+		v4l2_err(&sensor->sd, "%s: error: reg=%x\n",
+			 __func__, reg);
 		return ret;
+	}
 
 	*val = buf[0];
 	return 0;