[PATCH 1/3] i2c: designware: Initialize adapter name only when not set

Pratap Nirujogi posted 3 patches 6 months, 2 weeks ago
There is a newer version of this series
[PATCH 1/3] i2c: designware: Initialize adapter name only when not set
Posted by Pratap Nirujogi 6 months, 2 weeks ago
Check if the adapter name is already set in the driver prior
to initializing with generic name in i2c_dw_probe_master().

Fixes: 90b85567e457 ("platform/x86: Add AMD ISP platform config for OV05C10")
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/all/04577a46-9add-420c-b181-29bad582026d@infradead.org
Signed-off-by: Pratap Nirujogi <pratap.nirujogi@amd.com>
---
 drivers/i2c/busses/i2c-designware-master.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c
index c5394229b77f..ab03943d6aaf 100644
--- a/drivers/i2c/busses/i2c-designware-master.c
+++ b/drivers/i2c/busses/i2c-designware-master.c
@@ -1042,8 +1042,9 @@ int i2c_dw_probe_master(struct dw_i2c_dev *dev)
 	if (ret)
 		return ret;
 
-	snprintf(adap->name, sizeof(adap->name),
-		 "Synopsys DesignWare I2C adapter");
+	if (!adap->name[0])
+		snprintf(adap->name, sizeof(adap->name),
+			 "Synopsys DesignWare I2C adapter");
 	adap->retries = 3;
 	adap->algo = &i2c_dw_algo;
 	adap->quirks = &i2c_dw_quirks;
-- 
2.43.0
Re: [PATCH 1/3] i2c: designware: Initialize adapter name only when not set
Posted by Ilpo Järvinen 6 months, 2 weeks ago
On Fri, 30 May 2025, Pratap Nirujogi wrote:

> Check if the adapter name is already set in the driver prior
> to initializing with generic name in i2c_dw_probe_master().
> 
> Fixes: 90b85567e457 ("platform/x86: Add AMD ISP platform config for OV05C10")
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Link: https://lore.kernel.org/all/04577a46-9add-420c-b181-29bad582026d@infradead.org
> Signed-off-by: Pratap Nirujogi <pratap.nirujogi@amd.com>
> ---
>  drivers/i2c/busses/i2c-designware-master.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c
> index c5394229b77f..ab03943d6aaf 100644
> --- a/drivers/i2c/busses/i2c-designware-master.c
> +++ b/drivers/i2c/busses/i2c-designware-master.c
> @@ -1042,8 +1042,9 @@ int i2c_dw_probe_master(struct dw_i2c_dev *dev)
>  	if (ret)
>  		return ret;
>  
> -	snprintf(adap->name, sizeof(adap->name),
> -		 "Synopsys DesignWare I2C adapter");
> +	if (!adap->name[0])
> +		snprintf(adap->name, sizeof(adap->name),
> +			 "Synopsys DesignWare I2C adapter");

I'd convert this to scnprintf() here as well and add to the changelog:

While at it, convert to scnprintf() that is preferred over snprintf().

As with the other patch, this too is missing receipients (as indicated 
by the get_maintainers script).

-- 
 i.
Re: [PATCH 1/3] i2c: designware: Initialize adapter name only when not set
Posted by Nirujogi, Pratap 6 months, 2 weeks ago
Hi Ilpo,

On 5/31/2025 1:14 AM, Ilpo Järvinen wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> 
> 
> On Fri, 30 May 2025, Pratap Nirujogi wrote:
> 
>> Check if the adapter name is already set in the driver prior
>> to initializing with generic name in i2c_dw_probe_master().
>>
>> Fixes: 90b85567e457 ("platform/x86: Add AMD ISP platform config for OV05C10")
>> Reported-by: Randy Dunlap <rdunlap@infradead.org>
>> Link: https://lore.kernel.org/all/04577a46-9add-420c-b181-29bad582026d@infradead.org
>> Signed-off-by: Pratap Nirujogi <pratap.nirujogi@amd.com>
>> ---
>>   drivers/i2c/busses/i2c-designware-master.c | 5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c
>> index c5394229b77f..ab03943d6aaf 100644
>> --- a/drivers/i2c/busses/i2c-designware-master.c
>> +++ b/drivers/i2c/busses/i2c-designware-master.c
>> @@ -1042,8 +1042,9 @@ int i2c_dw_probe_master(struct dw_i2c_dev *dev)
>>        if (ret)
>>                return ret;
>>
>> -     snprintf(adap->name, sizeof(adap->name),
>> -              "Synopsys DesignWare I2C adapter");
>> +     if (!adap->name[0])
>> +             snprintf(adap->name, sizeof(adap->name),
>> +                      "Synopsys DesignWare I2C adapter");
> 
> I'd convert this to scnprintf() here as well and add to the changelog:
> 
> While at it, convert to scnprintf() that is preferred over snprintf().
> 
> As with the other patch, this too is missing receipients (as indicated
> by the get_maintainers script).
> 
Thank you, I will use scnprintf() inplace of snprintf() in v2 and will 
make sure to include all the intended receipients while sending the patch.

Thanks,
Pratap
> --
>   i.
>