From patchwork Mon Mar 30 23:20:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 210372 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CA41C43331 for ; Mon, 30 Mar 2020 23:21:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3967320675 for ; Mon, 30 Mar 2020 23:21:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="h8u/jhQu" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729197AbgC3XVD (ORCPT ); Mon, 30 Mar 2020 19:21:03 -0400 Received: from mail-pj1-f68.google.com ([209.85.216.68]:40951 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728991AbgC3XVD (ORCPT ); Mon, 30 Mar 2020 19:21:03 -0400 Received: by mail-pj1-f68.google.com with SMTP id kx8so270654pjb.5 for ; Mon, 30 Mar 2020 16:21:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=d7O/Y1UZRl9rjdivv3qavnHXyyAe8PaJzLYevt3jOgQ=; b=h8u/jhQufAmXUA5I6XKku2glveFk7ysky/HvcEneNmipgbBkgN+fFLo8ktl2kXPoFB Dux2rO/eKo79YQ4zXQHZMu9aXHcrtl4D46aOl3I0G3JCjPtcK82K3UL41u0XYNRoXGJx J8nGtKjmUGFMEiqFZo7LpdtoSG7mM0O/fJXjlrxKaCoK7tyT8NuONd48HhaAB/pHMoe5 Wqa5QdU4FbCPZXjWd6SpSeXw7WZ8lFNuHM6QrzDkRJo/Q6U80SKxJ2gP/te7mNJHNKB2 Fs4UDnx+/3EZu+EfX5+zh+fyY5KI1LVmYdCZQp8W5woLcDMRB5adQp2l0WaersrdbRuq GpWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=d7O/Y1UZRl9rjdivv3qavnHXyyAe8PaJzLYevt3jOgQ=; b=JEPIxaxwqeN4na985dugdUfs/2nHmVTSL3rY18z4Dx+bMIQHDxkxZ5JZra5eLgIEVy P3IJwgK/4gaPNTiluMyjAt+w9/6Y/MjfsasJBAaxrfWWzdVJ1vsqpnBmk/8cuJWvl+2G ugwPzo2IGnF5f9OUPxolCZuWM3c+3dU92I21y8We6OIjvRe+BQjtt5eaE8+z8jU8W+79 lup5yEd7rKIdx2DNNdhzcJgRRBzfFbwuaKFafAkhd7SDBfrbaQ9gr5MD0PGbpAg9sLhY yrhrLQKequmPZLBIQ9HhX/P621e4amxjyqFMygn8OEu+8D6wV7qOmaUpmt+5G1c7det2 SndQ== X-Gm-Message-State: AGi0PuYbeCXXhi3wUtl49TpXuwskC2BNPuZiz+JFKoVTI3HKUQXqeoWg BMtB0fYOW+zi8sYsT8ss3FXhbuuP X-Google-Smtp-Source: APiQypLWRAfWj9TQwiujWl1MeKNAOQzibGh3EA4igaoWMCuDnqIaoPrCYFxFNUC3JHoaNkq2qf50dA== X-Received: by 2002:a17:90a:9408:: with SMTP id r8mr555372pjo.15.1585610462469; Mon, 30 Mar 2020 16:21:02 -0700 (PDT) Received: from deeUbuntu ([103.241.226.99]) by smtp.gmail.com with ESMTPSA id x4sm9874334pga.54.2020.03.30.16.21.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Mar 2020 16:21:02 -0700 (PDT) Date: Tue, 31 Mar 2020 04:50:57 +0530 From: Deepak R Varma To: outreachy-kernel@googlegroups.com, gregkh@linuxfoundation.org Cc: Sakari Ailus , Mauro Carvalho Chehab , Greg Kroah-Hartman , linux-media@vger.kernel.org Subject: [PATCH v2] media: staging/intel-ipu3: Simplify single goto jump Message-ID: <20200330232053.GA7335@deeUbuntu> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org On successful node setup, the code jumps to a cleanup label to perform nodes cleanup. This only call to cleanup using goto label can be included in the for / if blocks to make it look more associated. Signed-off-by: Deepak R Varma Reviewed-by: Stefano Brivio --- Changes since v1: - Corrected /reduced scope of variable r. Warning generated by Sakari's Kbuild bot. Change advised by Sakari Ailus. - Patch was earlier reviewed by Stefano. The bot warning came in later. drivers/staging/media/ipu3/ipu3-v4l2.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c index e8f33539a217..beec8aad2d43 100644 --- a/drivers/staging/media/ipu3/ipu3-v4l2.c +++ b/drivers/staging/media/ipu3/ipu3-v4l2.c @@ -1291,19 +1291,17 @@ static void imgu_v4l2_nodes_cleanup_pipe(struct imgu_device *imgu, static int imgu_v4l2_nodes_setup_pipe(struct imgu_device *imgu, int pipe) { - int i, r; + int i; for (i = 0; i < IMGU_NODE_NUM; i++) { - r = imgu_v4l2_node_setup(imgu, pipe, i); - if (r) - goto cleanup; - } + int r = imgu_v4l2_node_setup(imgu, pipe, i); + if (r) { + imgu_v4l2_nodes_cleanup_pipe(imgu, pipe, i); + return r; + } + } return 0; - -cleanup: - imgu_v4l2_nodes_cleanup_pipe(imgu, pipe, i); - return r; } static void imgu_v4l2_subdev_cleanup(struct imgu_device *imgu, unsigned int i)