From patchwork Thu Apr 26 12:47:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Liu X-Patchwork-Id: 10365935 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3BA7B601BE for ; Thu, 26 Apr 2018 12:47:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C13B29117 for ; Thu, 26 Apr 2018 12:47:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20A5B2911B; Thu, 26 Apr 2018 12:47:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78FCB29117 for ; Thu, 26 Apr 2018 12:47:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755659AbeDZMrO (ORCPT ); Thu, 26 Apr 2018 08:47:14 -0400 Received: from fllnx209.ext.ti.com ([198.47.19.16]:10938 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753951AbeDZMrO (ORCPT ); Thu, 26 Apr 2018 08:47:14 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w3QClDh6002985 for ; Thu, 26 Apr 2018 07:47:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1524746833; bh=QGIQlVzXJWFV74KzgbNhNhZtt3OI3XbFsbb9rPIspTM=; h=From:To:CC:Subject:Date; b=nHfkIIOjTKC2LIMOf/HBXjj9A9iUBw/wInHNdWJV/BARrgQIkfdI/zOtN4KbNB4tF brbLJmrPJX8ubrC2rYOYJcJawjqyyDqradq3BYnK3kLW8ZjeEa7gagkhSWrP43SRi6 tjO2vF1Vcoe9aqc+acjMtBheoCdq0heB5mYvV/mc= Received: from DLEE104.ent.ti.com (dlee104.ent.ti.com [157.170.170.34]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3QClDiE008531 for ; Thu, 26 Apr 2018 07:47:13 -0500 Received: from DLEE114.ent.ti.com (157.170.170.25) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Thu, 26 Apr 2018 07:47:13 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Thu, 26 Apr 2018 07:47:13 -0500 Received: from uda0271908.am.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3QClDBW013473; Thu, 26 Apr 2018 07:47:13 -0500 From: Bin Liu To: CC: Sekhar Nori , Bin Liu Subject: [PATCH v2 1/3] usb: musb: gadget: fix to_musb_request() to not return NULL Date: Thu, 26 Apr 2018 07:47:11 -0500 Message-ID: <1524746833-19565-1-git-send-email-b-liu@ti.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The gadget function drivers should ensure the usb_request parameter passed in is not NULL. UDC core doesn't check if it is NULL, so MUSB driver shouldn't have to check it either. Convert to_musb_request() to a simple macro to not directly return NULL to avoid warnings from code static analysis tools. Signed-off-by: Bin Liu --- v2: revised the parentheses. drivers/usb/musb/musb_gadget.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/usb/musb/musb_gadget.h b/drivers/usb/musb/musb_gadget.h index 9c34aca06db6..06d60848337f 100644 --- a/drivers/usb/musb/musb_gadget.h +++ b/drivers/usb/musb/musb_gadget.h @@ -60,10 +60,7 @@ struct musb_request { enum buffer_map_state map_state; }; -static inline struct musb_request *to_musb_request(struct usb_request *req) -{ - return req ? container_of(req, struct musb_request, request) : NULL; -} +#define to_musb_request(r) container_of((r), struct musb_request, request) extern struct usb_request * musb_alloc_request(struct usb_ep *ep, gfp_t gfp_flags);