media: i2c: max9271: Check max9271_write() return
Check the return value of the max9271_write() function in the max9271 library driver. While at it, modify an existing condition to be made identical to other checks. Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
4ff5278dce
commit
ad01032aaf
@ -106,7 +106,10 @@ int max9271_set_serial_link(struct max9271_device *dev, bool enable)
|
|||||||
* Short delays here appear to show bit-errors in the writes following.
|
* Short delays here appear to show bit-errors in the writes following.
|
||||||
* Therefore a conservative delay seems best here.
|
* Therefore a conservative delay seems best here.
|
||||||
*/
|
*/
|
||||||
max9271_write(dev, 0x04, val);
|
ret = max9271_write(dev, 0x04, val);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
usleep_range(5000, 8000);
|
usleep_range(5000, 8000);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -118,7 +121,7 @@ int max9271_configure_i2c(struct max9271_device *dev, u8 i2c_config)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = max9271_write(dev, 0x0d, i2c_config);
|
ret = max9271_write(dev, 0x0d, i2c_config);
|
||||||
if (ret)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* The delay required after an I2C bus configuration change is not
|
/* The delay required after an I2C bus configuration change is not
|
||||||
@ -143,7 +146,10 @@ int max9271_set_high_threshold(struct max9271_device *dev, bool enable)
|
|||||||
* Enable or disable reverse channel high threshold to increase
|
* Enable or disable reverse channel high threshold to increase
|
||||||
* immunity to power supply noise.
|
* immunity to power supply noise.
|
||||||
*/
|
*/
|
||||||
max9271_write(dev, 0x08, enable ? ret | BIT(0) : ret & ~BIT(0));
|
ret = max9271_write(dev, 0x08, enable ? ret | BIT(0) : ret & ~BIT(0));
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
usleep_range(2000, 2500);
|
usleep_range(2000, 2500);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -152,6 +158,8 @@ EXPORT_SYMBOL_GPL(max9271_set_high_threshold);
|
|||||||
|
|
||||||
int max9271_configure_gmsl_link(struct max9271_device *dev)
|
int max9271_configure_gmsl_link(struct max9271_device *dev)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Configure the GMSL link:
|
* Configure the GMSL link:
|
||||||
*
|
*
|
||||||
@ -162,16 +170,24 @@ int max9271_configure_gmsl_link(struct max9271_device *dev)
|
|||||||
*
|
*
|
||||||
* TODO: Make the GMSL link configuration parametric.
|
* TODO: Make the GMSL link configuration parametric.
|
||||||
*/
|
*/
|
||||||
max9271_write(dev, 0x07, MAX9271_DBL | MAX9271_HVEN |
|
ret = max9271_write(dev, 0x07, MAX9271_DBL | MAX9271_HVEN |
|
||||||
MAX9271_EDC_1BIT_PARITY);
|
MAX9271_EDC_1BIT_PARITY);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
usleep_range(5000, 8000);
|
usleep_range(5000, 8000);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Adjust spread spectrum to +4% and auto-detect pixel clock
|
* Adjust spread spectrum to +4% and auto-detect pixel clock
|
||||||
* and serial link rate.
|
* and serial link rate.
|
||||||
*/
|
*/
|
||||||
max9271_write(dev, 0x02, MAX9271_SPREAD_SPECT_4 | MAX9271_R02_RES |
|
ret = max9271_write(dev, 0x02,
|
||||||
MAX9271_PCLK_AUTODETECT | MAX9271_SERIAL_AUTODETECT);
|
MAX9271_SPREAD_SPECT_4 | MAX9271_R02_RES |
|
||||||
|
MAX9271_PCLK_AUTODETECT |
|
||||||
|
MAX9271_SERIAL_AUTODETECT);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
usleep_range(5000, 8000);
|
usleep_range(5000, 8000);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user