lkml.org 
[lkml]   [2017]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH net-next 11/11] net: ethernet: ti: ale: fix port check in cpsw_ale_control_set/get
    Date
    ALE ports number includes the Host port and ext Ports, and
    ALE ports numbering starts from 0, so correct corresponding port
    checks in cpsw_ale_control_set/get().

    Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
    ---
    drivers/net/ethernet/ti/cpsw_ale.c | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)

    diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c
    index e513248..93dc05c 100644
    --- a/drivers/net/ethernet/ti/cpsw_ale.c
    +++ b/drivers/net/ethernet/ti/cpsw_ale.c
    @@ -723,7 +723,7 @@ int cpsw_ale_control_set(struct cpsw_ale *ale, int port, int control,
    if (info->port_offset == 0 && info->port_shift == 0)
    port = 0; /* global, port is a dont care */

    - if (port < 0 || port > ale->params.ale_ports)
    + if (port < 0 || port >= ale->params.ale_ports)
    return -EINVAL;

    mask = BITMASK(info->bits);
    @@ -754,7 +754,7 @@ int cpsw_ale_control_get(struct cpsw_ale *ale, int port, int control)
    if (info->port_offset == 0 && info->port_shift == 0)
    port = 0; /* global, port is a dont care */

    - if (port < 0 || port > ale->params.ale_ports)
    + if (port < 0 || port >= ale->params.ale_ports)
    return -EINVAL;

    offset = info->offset + (port * info->port_offset);
    --
    2.10.5
    \
     
     \ /
      Last update: 2017-12-01 08:42    [W:2.884 / U:1.136 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site