[2/2] media: i2c: imx258: validate rotation only if it is provided

Message ID 20201005151559.12003-2-krzk@kernel.org (mailing list archive)
State Rejected, archived
Delegated to: Sakari Ailus
Headers
Series [1/2] media: i2c: imx258: add HDR control |

Commit Message

Krzysztof Kozlowski Oct. 5, 2020, 3:15 p.m. UTC
  The sensor supports rotation by 180 degrees however the value of
"rotation" property should be validated only if it exists.  If
"rotation" is missing, do not fail the probe:

    imx258: probe of 3-001a failed with error -22

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 drivers/media/i2c/imx258.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Krzysztof Kozlowski Oct. 28, 2020, 9:23 a.m. UTC | #1
On Mon, Oct 05, 2020 at 05:15:59PM +0200, Krzysztof Kozlowski wrote:
> The sensor supports rotation by 180 degrees however the value of
> "rotation" property should be validated only if it exists.  If
> "rotation" is missing, do not fail the probe:
> 
>     imx258: probe of 3-001a failed with error -22
> 
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

This is actually a fix, so these should be added:
Fixes: 17121d12a5c1 ("media: imx258: Check the rotation property has a value of 180")
Cc: <stable@vger.kernel.org>

Best regards,
Krzysztof

> ---
>  drivers/media/i2c/imx258.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c
> index aedf8e7c6165..c52932e5b881 100644
> --- a/drivers/media/i2c/imx258.c
> +++ b/drivers/media/i2c/imx258.c
> @@ -1284,7 +1284,7 @@ static int imx258_probe(struct i2c_client *client)
>  	 * supports a single pixel order right now.
>  	 */
>  	ret = device_property_read_u32(&client->dev, "rotation", &val);
> -	if (ret || val != 180)
> +	if (!ret && val != 180)
>  		return -EINVAL;
>  
>  	/* Initialize subdev */
> -- 
> 2.17.1
>
  
Krzysztof Kozlowski Oct. 30, 2020, 11:32 a.m. UTC | #2
On Wed, Oct 28, 2020 at 10:23:43AM +0100, Krzysztof Kozlowski wrote:
> On Mon, Oct 05, 2020 at 05:15:59PM +0200, Krzysztof Kozlowski wrote:
> > The sensor supports rotation by 180 degrees however the value of
> > "rotation" property should be validated only if it exists.  If
> > "rotation" is missing, do not fail the probe:
> > 
> >     imx258: probe of 3-001a failed with error -22
> > 
> > Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> 
> This is actually a fix, so these should be added:
> Fixes: 17121d12a5c1 ("media: imx258: Check the rotation property has a value of 180")
> Cc: <stable@vger.kernel.org>
> 
> Best regards,
> Krzysztof

Please drop this patch. I misunderstood the comment.

Best regards,
Krzysztof
  

Patch

diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c
index aedf8e7c6165..c52932e5b881 100644
--- a/drivers/media/i2c/imx258.c
+++ b/drivers/media/i2c/imx258.c
@@ -1284,7 +1284,7 @@  static int imx258_probe(struct i2c_client *client)
 	 * supports a single pixel order right now.
 	 */
 	ret = device_property_read_u32(&client->dev, "rotation", &val);
-	if (ret || val != 180)
+	if (!ret && val != 180)
 		return -EINVAL;
 
 	/* Initialize subdev */