[PATCH] pinctrl: rzg2l: Variable may not have been assigned to

Andrew Goodbody andrew.goodbody at linaro.org
Thu Aug 7 15:13:26 CEST 2025


On 07/08/2025 13:13, Paul Barker wrote:
> On Thu, 2025-08-07 at 12:30 +0100, Andrew Goodbody wrote:
>> In rzg2l_pinconf_set and rzg2l_get_pin_muxing if the call to
>> rzg2l_selector_decode fails then the variable pin may not have been
>> assigned to. Remove the use of pin from the error message.
>>
>> This issue was found by Smatch.
>>
>> Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
>> ---
>>   drivers/pinctrl/renesas/rzg2l-pfc.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/pinctrl/renesas/rzg2l-pfc.c b/drivers/pinctrl/renesas/rzg2l-pfc.c
>> index 3c751e9473a..3bdba5e365c 100644
>> --- a/drivers/pinctrl/renesas/rzg2l-pfc.c
>> +++ b/drivers/pinctrl/renesas/rzg2l-pfc.c
>> @@ -353,7 +353,7 @@ static int rzg2l_pinconf_set(struct udevice *dev, unsigned int pin_selector,
>>   		/* The pin selector refers to a multiplexed pin */
>>   		int port = rzg2l_selector_decode(data, pin_selector, &pin);
>>   		if (port < 0) {
>> -			dev_err(dev, "Invalid pin selector %u:%u\n", port, pin);
>> +			dev_err(dev, "Invalid pin selector %u\n", port);
> 
> Thanks for catching this and sending a patch!
> 
> The proposed change is actually still invalid - port is a signed value so %u is
> wrong, and port will just be a negative error number here.
> 
> What I should have done is printed the invalid selector, which is an unsigned
> int:
> 
>      dev_err(dev, "Invalid pin selector %u\n", pin_selector);
> 
>>   			return port;
>>   		}
>>   
>> @@ -550,7 +550,7 @@ static int rzg2l_get_pin_muxing(struct udevice *dev, unsigned int selector,
>>   
>>   	port = rzg2l_selector_decode(data, selector, &pin);
>>   	if (port < 0) {
>> -		dev_err(dev, "Invalid pin selector %u:%u\n", port, pin);
>> +		dev_err(dev, "Invalid pin selector %u\n", port);
> 
> Ditto here:
> 
>      dev_err(dev, "Invalid pin selector %u\n", selector);
> 
> Do you want to send a v2?
> 
> Thanks,
> 

Thanks for the comments, yes I will send a V2.

Andrew


More information about the U-Boot mailing list