From patchwork Mon Sep 2 18:43:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin King X-Patchwork-Id: 11127009 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 231F315E9 for ; Mon, 2 Sep 2019 18:43:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 03F8E216C8 for ; Mon, 2 Sep 2019 18:43:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726877AbfIBSnj (ORCPT ); Mon, 2 Sep 2019 14:43:39 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:45894 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726805AbfIBSnj (ORCPT ); Mon, 2 Sep 2019 14:43:39 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1i4rIc-0000PM-Os; Mon, 02 Sep 2019 18:43:34 +0000 From: Colin King To: Greg Kroah-Hartman , Pawel Laszczak , Felipe Balbi , linux-usb@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] usb: cdns3: remove redundant assignment to ret on error exit path Date: Mon, 2 Sep 2019 19:43:34 +0100 Message-Id: <20190902184334.27406-1-colin.king@canonical.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Colin Ian King In the case where an allocation fails for priv_ep ret is assigned -ENOMEM and the code exits via the exit path 'err'. The exit path returns -ENOMEM without using variable ret, so the assingment is redundant and can be removed. Addresses-Coverity: ("Unused value") Signed-off-by: Colin Ian King --- drivers/usb/cdns3/gadget.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c index 0eb3022838d6..de0e14a4fb9f 100644 --- a/drivers/usb/cdns3/gadget.c +++ b/drivers/usb/cdns3/gadget.c @@ -2447,10 +2447,8 @@ static int cdns3_init_eps(struct cdns3_device *priv_dev) priv_ep = devm_kzalloc(priv_dev->dev, sizeof(*priv_ep), GFP_KERNEL); - if (!priv_ep) { - ret = -ENOMEM; + if (!priv_ep) goto err; - } /* set parent of endpoint object */ priv_ep->cdns3_dev = priv_dev;