diff mbox series

accel/qaic: silence some uninitialized variable warnings

Message ID d11ee378-7b06-4b5e-b56f-d66174be1ab3@kili.mountain
State Accepted
Commit 2d2f5f1e8fd91fe848aacde28f738fb8e8d95a27
Headers show
Series accel/qaic: silence some uninitialized variable warnings | expand

Commit Message

Dan Carpenter May 3, 2023, 10:41 a.m. UTC
Smatch complains that these are not initialized if get_cntl_version()
fails but we still print them in the debug message.  Not the end of
the world, but true enough.  Let's just initialize them to a dummy value
to make the checker happy.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/accel/qaic/qaic_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jeffrey Hugo May 10, 2023, 2:57 p.m. UTC | #1
On 5/3/2023 4:41 AM, Dan Carpenter wrote:
> Smatch complains that these are not initialized if get_cntl_version()
> fails but we still print them in the debug message.  Not the end of
> the world, but true enough.  Let's just initialize them to a dummy value
> to make the checker happy.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Thanks for the cleanup.

Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>

Could use a fixes tag, and also I'd prefer to maintain the style of 
sorting the variable declaration lines by line length.  Given the minor 
nature of these nits, I plan to address them.
Dan Carpenter May 10, 2023, 4:48 p.m. UTC | #2
On Wed, May 10, 2023 at 08:57:03AM -0600, Jeffrey Hugo wrote:
> On 5/3/2023 4:41 AM, Dan Carpenter wrote:
> > Smatch complains that these are not initialized if get_cntl_version()
> > fails but we still print them in the debug message.  Not the end of
> > the world, but true enough.  Let's just initialize them to a dummy value
> > to make the checker happy.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> 
> Thanks for the cleanup.
> 
> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
> 
> Could use a fixes tag

The fixes tag thing could have gone either way.  It's really minor.

> and also I'd prefer to maintain the style of sorting
> the variable declaration lines by line length.  Given the minor nature of
> these nits, I plan to address them.

Thanks!

regards,
dan carpenter
Carl Vanderlip May 11, 2023, 3:34 p.m. UTC | #3
On 5/3/2023 3:41 AM, Dan Carpenter wrote:
> Smatch complains that these are not initialized if get_cntl_version()
> fails but we still print them in the debug message.  Not the end of
> the world, but true enough.  Let's just initialize them to a dummy value
> to make the checker happy.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

LGTM

Reviewed-by: Carl Vanderlip <quic_carlv@quicinc.com>
Pranjal Ramajor Asha Kanojiya May 11, 2023, 7:46 p.m. UTC | #4
On 5/3/2023 4:11 PM, Dan Carpenter wrote:
> Smatch complains that these are not initialized if get_cntl_version()
> fails but we still print them in the debug message.  Not the end of
> the world, but true enough.  Let's just initialize them to a dummy value
> to make the checker happy.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>   drivers/accel/qaic/qaic_drv.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/accel/qaic/qaic_drv.c b/drivers/accel/qaic/qaic_drv.c
> index ff80eb571729..e10e8b603e37 100644
> --- a/drivers/accel/qaic/qaic_drv.c
> +++ b/drivers/accel/qaic/qaic_drv.c
> @@ -263,7 +263,7 @@ static void qaic_destroy_drm_device(struct qaic_device *qdev, s32 partition_id)
>   static int qaic_mhi_probe(struct mhi_device *mhi_dev, const struct mhi_device_id *id)
>   {
>   	struct qaic_device *qdev;
> -	u16 major, minor;
> +	u16 major = -1, minor = -1;
>   	int ret;
>   
>   	/*
> 

Thank you Dan for the patch.

Reviewed-by: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>

I agree with Jeff's comment to sort the variable declaration length wise.
Jeffrey Hugo May 16, 2023, 7:24 p.m. UTC | #5
On 5/10/2023 10:48 AM, Dan Carpenter wrote:
> On Wed, May 10, 2023 at 08:57:03AM -0600, Jeffrey Hugo wrote:
>> On 5/3/2023 4:41 AM, Dan Carpenter wrote:
>>> Smatch complains that these are not initialized if get_cntl_version()
>>> fails but we still print them in the debug message.  Not the end of
>>> the world, but true enough.  Let's just initialize them to a dummy value
>>> to make the checker happy.
>>>
>>> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
>>
>> Thanks for the cleanup.
>>
>> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
>>
>> Could use a fixes tag
> 
> The fixes tag thing could have gone either way.  It's really minor.
> 
>> and also I'd prefer to maintain the style of sorting
>> the variable declaration lines by line length.  Given the minor nature of
>> these nits, I plan to address them.
> 
> Thanks!

Pushed to drm-misc-fixes

-Jeff
diff mbox series

Patch

diff --git a/drivers/accel/qaic/qaic_drv.c b/drivers/accel/qaic/qaic_drv.c
index ff80eb571729..e10e8b603e37 100644
--- a/drivers/accel/qaic/qaic_drv.c
+++ b/drivers/accel/qaic/qaic_drv.c
@@ -263,7 +263,7 @@  static void qaic_destroy_drm_device(struct qaic_device *qdev, s32 partition_id)
 static int qaic_mhi_probe(struct mhi_device *mhi_dev, const struct mhi_device_id *id)
 {
 	struct qaic_device *qdev;
-	u16 major, minor;
+	u16 major = -1, minor = -1;
 	int ret;
 
 	/*