diff mbox series

soundwire: intel: Fix uninitialized adev deref

Message ID 20180807064113.8114-1-vkoul@kernel.org (mailing list archive)
State New, archived
Headers show
Series soundwire: intel: Fix uninitialized adev deref | expand

Commit Message

Vinod Koul Aug. 7, 2018, 6:41 a.m. UTC
In case of error, we can dereference uninitialized 'adev'

drivers/soundwire/intel_init.c:154 sdw_intel_acpi_cb()
error: uninitialized symbol 'adev'.

Fix that by not using adev for warn print and make it pr_err.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
---
 drivers/soundwire/intel_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Pierre-Louis Bossart Aug. 7, 2018, 2:22 p.m. UTC | #1
On 8/7/18 1:41 AM, Vinod Koul wrote:
> In case of error, we can dereference uninitialized 'adev'
> 
> drivers/soundwire/intel_init.c:154 sdw_intel_acpi_cb()
> error: uninitialized symbol 'adev'.
> 
> Fix that by not using adev for warn print and make it pr_err.
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Vinod Koul <vkoul@kernel.org>

Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

> ---
>   drivers/soundwire/intel_init.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c
> index d1ea6b4d0ad3..5c8a20d99878 100644
> --- a/drivers/soundwire/intel_init.c
> +++ b/drivers/soundwire/intel_init.c
> @@ -151,7 +151,7 @@ static acpi_status sdw_intel_acpi_cb(acpi_handle handle, u32 level,
>   	struct acpi_device *adev;
>   
>   	if (acpi_bus_get_device(handle, &adev)) {
> -		dev_err(&adev->dev, "Couldn't find ACPI handle\n");
> +		pr_err("%s: Couldn't find ACPI handle\n", __func__);
>   		return AE_NOT_FOUND;
>   	}
>   
>
diff mbox series

Patch

diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c
index d1ea6b4d0ad3..5c8a20d99878 100644
--- a/drivers/soundwire/intel_init.c
+++ b/drivers/soundwire/intel_init.c
@@ -151,7 +151,7 @@  static acpi_status sdw_intel_acpi_cb(acpi_handle handle, u32 level,
 	struct acpi_device *adev;
 
 	if (acpi_bus_get_device(handle, &adev)) {
-		dev_err(&adev->dev, "Couldn't find ACPI handle\n");
+		pr_err("%s: Couldn't find ACPI handle\n", __func__);
 		return AE_NOT_FOUND;
 	}