[PATCH] button: qcom-pmic: Fix dereference of uninitialised pointer

Casey Connolly casey.connolly at linaro.org
Fri Jul 25 15:25:24 CEST 2025



On 23/07/2025 12:58, Andrew Goodbody wrote:
> The pointer 'label' is declared and later dereferenced without ever
> having a value assigned to it. Add an assignment to this pointer so it
> will be valid later when dereferenced.
> 
> This issue was found by Smatch.
> 
> Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>

Reviewed-by: Casey Connolly <casey.connolly at linaro.org>

> ---
>  drivers/button/button-qcom-pmic.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/button/button-qcom-pmic.c b/drivers/button/button-qcom-pmic.c
> index 85addfe32a2..b823490d6d5 100644
> --- a/drivers/button/button-qcom-pmic.c
> +++ b/drivers/button/button-qcom-pmic.c
> @@ -195,8 +195,9 @@ static int button_qcom_pmic_bind(struct udevice *parent)
>  			continue;
>  		}
>  
> +		label = ofnode_get_name(node);
>  		ret = device_bind_driver_to_node(parent, "qcom_pwrkey",
> -						 ofnode_get_name(node),
> +						 label,
>  						 node, &dev);
>  		if (ret) {
>  			printf("Failed to bind %s! %d\n", label, ret);
> 
> ---
> base-commit: bd0ade7d090a334b3986936d63a34001d99722ad
> change-id: 20250723-button-qcom-pmic-882cb5415dd6
> 
> Best regards,

-- 
// Casey (she/her)



More information about the U-Boot mailing list