diff options
-rw-r--r-- | common/i2c_master.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/common/i2c_master.c b/common/i2c_master.c index d5eeaab04b..956de25d3e 100644 --- a/common/i2c_master.c +++ b/common/i2c_master.c @@ -53,6 +53,10 @@ static int i2c_port_is_locked(int port) /* Test the controller, not the port */ port = i2c_port_to_controller(port); #endif + /* can't lock a non-existing port */ + if (port < 0) + return 0; + return (i2c_port_active_list >> port) & 1; } |