From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756135AbcCWQvU (ORCPT ); Wed, 23 Mar 2016 12:51:20 -0400 Received: from vps0.lunn.ch ([178.209.37.122]:55535 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753439AbcCWQvR (ORCPT ); Wed, 23 Mar 2016 12:51:17 -0400 Date: Wed, 23 Mar 2016 17:51:11 +0100 From: Andrew Lunn To: Arnd Bergmann Cc: Jiri Pirko , Ido Schimmel , "David S. Miller" , Elad Raz , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: mlxsw: avoid unused variable warnings Message-ID: <20160323165111.GJ5250@lunn.ch> References: <1458751080-2044921-1-git-send-email-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1458751080-2044921-1-git-send-email-arnd@arndb.de> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 23, 2016 at 05:37:38PM +0100, Arnd Bergmann wrote: > dev_dbg_ratelimited() is a macro that ignores its arguments when DEBUG is > not set, which can lead to unused variable warnings: > > ethernet/mellanox/mlxsw/pci.c: In function 'mlxsw_pci_cqe_sdq_handle': > ethernet/mellanox/mlxsw/pci.c:646:18: warning: unused variable 'pdev' [-Wunused-variable] > ethernet/mellanox/mlxsw/pci.c: In function 'mlxsw_pci_cqe_rdq_handle': > ethernet/mellanox/mlxsw/pci.c:671:18: warning: unused variable 'pdev' [-Wunused-variable] > > This changes the mlxsw driver to remove the local variables we get > warnings for and instead pass the device directly into the API. Hi Arnd Would it not be better to fix the macro? I think the issue is that dev_dbg_ratelimited calls no_printk(), without making use of dev. So how about: #define dev_dbg_ratelimited(dev, fmt, ...) \ ({ \ if (0) \ dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \ }) This follows the pattern for other macros for when DEBUG is not defined. Andrew