From patchwork Sun Nov 5 13:10:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 10042129 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 69FA5604D3 for ; Sun, 5 Nov 2017 13:10:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BAEB29535 for ; Sun, 5 Nov 2017 13:10:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3FCBD2954A; Sun, 5 Nov 2017 13:10:48 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BD8D629536 for ; Sun, 5 Nov 2017 13:10:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 644CF6E106; Sun, 5 Nov 2017 13:10:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.web.de (mout.web.de [212.227.15.3]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1A5476E106 for ; Sun, 5 Nov 2017 13:10:42 +0000 (UTC) Received: from [192.168.1.3] ([92.227.245.53]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LoYWI-1dV8K31UTa-00gUvL; Sun, 05 Nov 2017 14:10:33 +0100 To: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, Bartlomiej Zolnierkiewicz , Nicolas Ferre From: SF Markus Elfring Subject: [PATCH] video: atmel_lcdfb: Use common error handling code in atmel_lcdfb_of_init() Message-ID: <2db677d2-ad4e-1f79-344b-dfa38ce948c9@users.sourceforge.net> Date: Sun, 5 Nov 2017 14:10:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 Content-Language: en-GB X-Provags-ID: V03:K0:SmXLhpMWPdjqeZTOJxnPZif9J+P9KNck+Mm5X7vex6ugA3/ZwY5 NXM1xlHouEURYMhphj0wGr/WwdIr9XCjmtol5IIovyzMmA7NNQ6lP/wr1n7tfK822xQ1xpE 2TPBBgYSwqv7+f7mk6IjT+eGu/9ZufuZVMtxEySnU4j0wJDEC7zs3BlZlONGyH3V6n9uSRw VImMh8o0RW+5LNlfA9Ipw== X-UI-Out-Filterresults: notjunk:1; V01:K0:Vo3sLJNzZ+I=:WrPQjpDZYDmh60tN4Rg3H6 rNupyoxh4rUsFgYlTTCgeokqv0GvHB3IdJQKWCsqXdcL+UVFGp2oBxY0+vodAyZVzEkN7jtxo 3lK4eWj1Y/qKF8Vwi1Z3sjC6gyje5B3+lSp2otE3vpZF0DfqHNZthhzQ54OolUGp3HJ+pI8Io t+r1nHRW6pqqdr7L9CK/k8Pxh0iDIvvQZ/dN2fvoFfNWSlcPD2PvfYYo53Ysm8gl5bOJM1wW/ 0ya0PLXZqGhJGX+adqC3ZbgW9GnGRPKK+kWOO0kng/8kWcPQ3TUC/UIOJ2VxKY0E6gD/y52X9 dzqNeMtKRlGpRQiVibQhCgSW27q3q6rEvmP1u0m3w/nWcORYHXKigz4eMDjLh5plpxBqgdALG qEZz4Xn3VCvih66/QD/2pcJaVemeiX25dueUddVxqwOGpYU4tQyeFM4kUfHpEtfARJ7jnd/8e eIt93UCacBEpX9ymeN8DTYkaHFVed8GyZevI+g8AKwW2taHPUqzBqC7tvhPjmUVpfznw8yTDt n5homspk2oNmvCwkFlcnHTAHCX+C1KGgru4MAT9Ii+posxRlUgpSmxYRHeJss3Tt1TSwZdLSb SPTL5WDBPepWR5YYd+Ucmz2fnS9rTcwPeIqgPsoM7CQSKpaV8kQrOUI3EAe6d4f54A8Eyv4HM 2JID49o1ks3hiEr3OSlKzaEaw+gyncAfIusXpiEx2gCr56jP+CguBmVSy3XnYiKs+4dfHirGj 8feRBP1bA+5+8DwmBekcFhGZ/tkW1iUCF8zWZMwbvpv9v17v+s9MzzpSHtR419kTuPetWK1RZ NC/V5LDpH9HWBWnnsUK0XT3SEDVlpiXxTHCvDiTSaVLnd6FQ2U= Cc: kernel-janitors@vger.kernel.org, LKML X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sun, 5 Nov 2017 14:00:52 +0100 Add a jump target so that a specific error message is stored only once at the end of this function implementation. Replace two calls of the function "dev_err" by goto statements. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/video/fbdev/atmel_lcdfb.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c index e06358da4b99..3672c2e52ebd 100644 --- a/drivers/video/fbdev/atmel_lcdfb.c +++ b/drivers/video/fbdev/atmel_lcdfb.c @@ -1047,10 +1047,8 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) } ret = of_property_read_u32(display_np, "bits-per-pixel", &var->bits_per_pixel); - if (ret < 0) { - dev_err(dev, "failed to get property bits-per-pixel\n"); - goto put_display_node; - } + if (ret < 0) + goto report_bits_failure; ret = of_property_read_u32(display_np, "atmel,guard-time", &pdata->guard_time); if (ret < 0) { @@ -1065,10 +1063,8 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) } ret = of_property_read_u32(display_np, "atmel,dmacon", &pdata->default_dmacon); - if (ret < 0) { - dev_err(dev, "failed to get property bits-per-pixel\n"); - goto put_display_node; - } + if (ret < 0) + goto report_bits_failure; INIT_LIST_HEAD(&pdata->pwr_gpios); ret = -ENOMEM; @@ -1147,6 +1143,10 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) put_display_node: of_node_put(display_np); return ret; + +report_bits_failure: + dev_err(dev, "failed to get property bits-per-pixel\n"); + goto put_display_node; } #else static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)