From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751377AbdBBSVc (ORCPT ); Thu, 2 Feb 2017 13:21:32 -0500 Received: from esa7.dell-outbound.iphmx.com ([68.232.153.96]:21008 "EHLO esa7.dell-outbound.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750878AbdBBSVb (ORCPT ); Thu, 2 Feb 2017 13:21:31 -0500 X-Greylist: delayed 666 seconds by postgrey-1.27 at vger.kernel.org; Thu, 02 Feb 2017 13:21:31 EST X-DKIM: OpenDKIM Filter v2.4.3 mailuogwprd05.lss.emc.com v12IAHBD002670 From: "Allen Hubbe" To: "'Serge Semin'" , , , Cc: , , References: <1485985051-29346-1-git-send-email-fancer.lancer@gmail.com> In-Reply-To: <1485985051-29346-1-git-send-email-fancer.lancer@gmail.com> Subject: RE: [PATCH] NTB: Add IDT 89HPESxNTx PCIe-switches support Date: Thu, 2 Feb 2017 13:10:04 -0500 Message-ID: <000001d27d7f$967711b0$c3653510$@dell.com> MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQHSfNN1BTKRg9O5vkm6+i5ShYlHQKFWBVjg Content-Language: en-us X-RSA-Classifications: Source Code, public X-Sentrion-Hostname: mailuogwprd05.lss.emc.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Serge Semin > +static void idt_nt_write(struct idt_ntb_dev *ndev, > + const unsigned int reg, const u32 data) > +{ > + /* > + * It's obvious bug to request a register exceeding the maximum possible > + * value as well as to have it unaligned. > + */ > + BUG_ON(reg > IDT_REG_PCI_MAX || !IS_ALIGNED(reg, IDT_REG_ALIGN)); Avoid BUG_ON. Just warn and do nothing (at least, do nothing destructive) instead of crashing the system. Here, and throughout the driver. > +#define to_dev_ndev(ndev) (&((ndev)->ntb.dev)) > +#define to_pci_ndev(ndev) ((ndev)->ntb.pdev) See Logan's recent patches in "Style fixes: open code obfuscating macros."