diff mbox series

[v2,2/2] i2c: fsi: Prevent adding adapters for ports without dts nodes

Message ID 20200609201555.11401-3-eajames@linux.ibm.com
State Accepted
Commit 58031a26bf2b0c458511df146143c78ab569f4da
Headers show
Series i2c: fsi: Fixes for systems with more ports | expand

Commit Message

Eddie James June 9, 2020, 8:15 p.m. UTC
Ports should be defined in the devicetree if they are to be enabled on
the system.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
Changes since v1:
 - Remove the check for null device node since that is checked in
   of_device_is_available

 drivers/i2c/busses/i2c-fsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Wolfram Sang July 4, 2020, 6:39 a.m. UTC | #1
On Tue, Jun 09, 2020 at 03:15:55PM -0500, Eddie James wrote:
> Ports should be defined in the devicetree if they are to be enabled on

> the system.


The patch description does not really fit anymore, does it? There is no
change in behaviour, we just remove a redundant check.

> 

> Signed-off-by: Eddie James <eajames@linux.ibm.com>

> Signed-off-by: Joel Stanley <joel@jms.id.au>

> ---

> Changes since v1:

>  - Remove the check for null device node since that is checked in

>    of_device_is_available

> 

>  drivers/i2c/busses/i2c-fsi.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c

> index 977d6f524649..10332693edf0 100644

> --- a/drivers/i2c/busses/i2c-fsi.c

> +++ b/drivers/i2c/busses/i2c-fsi.c

> @@ -703,7 +703,7 @@ static int fsi_i2c_probe(struct device *dev)

>  

>  	for (port_no = 0; port_no < ports; port_no++) {

>  		np = fsi_i2c_find_port_of_node(dev->of_node, port_no);

> -		if (np && !of_device_is_available(np))

> +		if (!of_device_is_available(np))

>  			continue;

>  

>  		port = kzalloc(sizeof(*port), GFP_KERNEL);

> -- 

> 2.24.0

>
Eddie James July 6, 2020, 1:53 p.m. UTC | #2
On 7/4/20 1:39 AM, Wolfram Sang wrote:
> On Tue, Jun 09, 2020 at 03:15:55PM -0500, Eddie James wrote:

>> Ports should be defined in the devicetree if they are to be enabled on

>> the system.

> The patch description does not really fit anymore, does it? There is no

> change in behaviour, we just remove a redundant check.



Hi, it does change the behavior actually. By checking for the device 
node pointer, it would proceed and create the port for a NULL device 
node, which is not the desired behavior.


Thanks,

Eddie


>

>> Signed-off-by: Eddie James <eajames@linux.ibm.com>

>> Signed-off-by: Joel Stanley <joel@jms.id.au>

>> ---

>> Changes since v1:

>>   - Remove the check for null device node since that is checked in

>>     of_device_is_available

>>

>>   drivers/i2c/busses/i2c-fsi.c | 2 +-

>>   1 file changed, 1 insertion(+), 1 deletion(-)

>>

>> diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c

>> index 977d6f524649..10332693edf0 100644

>> --- a/drivers/i2c/busses/i2c-fsi.c

>> +++ b/drivers/i2c/busses/i2c-fsi.c

>> @@ -703,7 +703,7 @@ static int fsi_i2c_probe(struct device *dev)

>>   

>>   	for (port_no = 0; port_no < ports; port_no++) {

>>   		np = fsi_i2c_find_port_of_node(dev->of_node, port_no);

>> -		if (np && !of_device_is_available(np))

>> +		if (!of_device_is_available(np))

>>   			continue;

>>   

>>   		port = kzalloc(sizeof(*port), GFP_KERNEL);

>> -- 

>> 2.24.0

>>
Wolfram Sang July 6, 2020, 2:01 p.m. UTC | #3
> Hi, it does change the behavior actually. By checking for the device node

> pointer, it would proceed and create the port for a NULL device node, which

> is not the desired behavior.


Brown paper bag, please...
Wolfram Sang July 24, 2020, 7:32 p.m. UTC | #4
On Tue, Jun 09, 2020 at 03:15:55PM -0500, Eddie James wrote:
> Ports should be defined in the devicetree if they are to be enabled on

> the system.

> 

> Signed-off-by: Eddie James <eajames@linux.ibm.com>

> Signed-off-by: Joel Stanley <joel@jms.id.au>


Applied to for-next, thanks!
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c
index 977d6f524649..10332693edf0 100644
--- a/drivers/i2c/busses/i2c-fsi.c
+++ b/drivers/i2c/busses/i2c-fsi.c
@@ -703,7 +703,7 @@  static int fsi_i2c_probe(struct device *dev)
 
 	for (port_no = 0; port_no < ports; port_no++) {
 		np = fsi_i2c_find_port_of_node(dev->of_node, port_no);
-		if (np && !of_device_is_available(np))
+		if (!of_device_is_available(np))
 			continue;
 
 		port = kzalloc(sizeof(*port), GFP_KERNEL);