[1/2] soc: qcom: dcc: Signedness bug in config_reset_write()

Message ID Y7asNqoIapctHmbI@kili
State New
Headers
Series [1/2] soc: qcom: dcc: Signedness bug in config_reset_write() |

Commit Message

Dan Carpenter Jan. 5, 2023, 10:53 a.m. UTC
  The "ret" variable needs to be signed for the error handling to work.

Fixes: 4cbe60cf5ad6 ("soc: qcom: dcc: Add driver support for Data Capture and Compare unit(DCC)")
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
 drivers/soc/qcom/dcc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Konrad Dybcio Jan. 5, 2023, 11:47 a.m. UTC | #1
The commit message should be written in an imperative manner,
such as "Fix X, make Y do Z"

For the code:

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad

On 5.01.2023 11:53, Dan Carpenter wrote:
> The "ret" variable needs to be signed for the error handling to work.
> 
> Fixes: 4cbe60cf5ad6 ("soc: qcom: dcc: Add driver support for Data Capture and Compare unit(DCC)")
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
>  drivers/soc/qcom/dcc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/qcom/dcc.c b/drivers/soc/qcom/dcc.c
> index d4101f79cb5d..1e2cbefc1655 100644
> --- a/drivers/soc/qcom/dcc.c
> +++ b/drivers/soc/qcom/dcc.c
> @@ -808,8 +808,9 @@ static ssize_t config_reset_write(struct file *filp,
>  				  const char __user *user_buf, size_t count,
>  				  loff_t *ppos)
>  {
> -	unsigned int val, ret;
> +	unsigned int val;
>  	struct dcc_drvdata *drvdata = filp->private_data;
> +	int ret;
>  
>  	ret = kstrtouint_from_user(user_buf, count, 0, &val);
>  	if (ret < 0)
  
Dan Carpenter Jan. 5, 2023, 1:30 p.m. UTC | #2
On Thu, Jan 05, 2023 at 12:47:45PM +0100, Konrad Dybcio wrote:
> The commit message should be written in an imperative manner,
> such as "Fix X, make Y do Z"
> 

Imperative tense requirements are a symptom of bureaucracy run mad.  I
always want to push back against that.  We accrete layers of
requirements like case-bearing leaf beetles making armor out of poop.

regards,
dan carpenter
  
Alex Elder Jan. 5, 2023, 1:49 p.m. UTC | #3
On 1/5/23 4:53 AM, Dan Carpenter wrote:
> The "ret" variable needs to be signed for the error handling to work.

The fix looks good.  I'm sorry I missed this one in review.

Reviewed-by: Alex Elder <elder@linaro.org>

> 
> Fixes: 4cbe60cf5ad6 ("soc: qcom: dcc: Add driver support for Data Capture and Compare unit(DCC)")
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
>   drivers/soc/qcom/dcc.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/qcom/dcc.c b/drivers/soc/qcom/dcc.c
> index d4101f79cb5d..1e2cbefc1655 100644
> --- a/drivers/soc/qcom/dcc.c
> +++ b/drivers/soc/qcom/dcc.c
> @@ -808,8 +808,9 @@ static ssize_t config_reset_write(struct file *filp,
>   				  const char __user *user_buf, size_t count,
>   				  loff_t *ppos)
>   {
> -	unsigned int val, ret;
> +	unsigned int val;
>   	struct dcc_drvdata *drvdata = filp->private_data;
> +	int ret;
>   
>   	ret = kstrtouint_from_user(user_buf, count, 0, &val);
>   	if (ret < 0)
  

Patch

diff --git a/drivers/soc/qcom/dcc.c b/drivers/soc/qcom/dcc.c
index d4101f79cb5d..1e2cbefc1655 100644
--- a/drivers/soc/qcom/dcc.c
+++ b/drivers/soc/qcom/dcc.c
@@ -808,8 +808,9 @@  static ssize_t config_reset_write(struct file *filp,
 				  const char __user *user_buf, size_t count,
 				  loff_t *ppos)
 {
-	unsigned int val, ret;
+	unsigned int val;
 	struct dcc_drvdata *drvdata = filp->private_data;
+	int ret;
 
 	ret = kstrtouint_from_user(user_buf, count, 0, &val);
 	if (ret < 0)