Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752588AbbBYNuT (ORCPT ); Wed, 25 Feb 2015 08:50:19 -0500 Received: from mail-qg0-f52.google.com ([209.85.192.52]:56943 "EHLO mail-qg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751339AbbBYNuQ (ORCPT ); Wed, 25 Feb 2015 08:50:16 -0500 MIME-Version: 1.0 In-Reply-To: <20150225133612.GV19745@mwanda> References: <20150225133612.GV19745@mwanda> Date: Wed, 25 Feb 2015 05:50:15 -0800 Message-ID: Subject: Re: [patch 2/2] rocker: silence shift wrapping warning From: Scott Feldman To: Dan Carpenter Cc: Jiri Pirko , Netdev , "linux-kernel@vger.kernel.org" , kernel-janitors@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1386 Lines: 31 On Wed, Feb 25, 2015 at 5:36 AM, Dan Carpenter wrote: > "val" is declared as a u64 so static checkers complain that this shift > can wrap. I don't have the hardware but probably it's doesn't have over > 31 ports. Still we may as well silence the warning even if it's not a > real bug. > > Signed-off-by: Dan Carpenter > > diff --git a/drivers/net/ethernet/rocker/rocker.c b/drivers/net/ethernet/rocker/rocker.c > index 713a13c..9fb6948 100644 > --- a/drivers/net/ethernet/rocker/rocker.c > +++ b/drivers/net/ethernet/rocker/rocker.c > @@ -1257,9 +1257,9 @@ static void rocker_port_set_enable(struct rocker_port *rocker_port, bool enable) > u64 val = rocker_read64(rocker_port->rocker, PORT_PHYS_ENABLE); > > if (enable) > - val |= 1 << rocker_port->lport; > + val |= 1ULL << rocker_port->lport; > else > - val &= ~(1 << rocker_port->lport); > + val &= ~(1ULL << rocker_port->lport); > rocker_write64(rocker_port->rocker, PORT_PHYS_ENABLE, val); > } > Acked-by: Scott Feldman -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/