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: 10042127 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 5A41260247 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 33D4C29537 for ; Sun, 5 Nov 2017 13:10:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2720229539; 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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 AAFB029535 for ; Sun, 5 Nov 2017 13:10:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752568AbdKENKq (ORCPT ); Sun, 5 Nov 2017 08:10:46 -0500 Received: from mout.web.de ([212.227.15.3]:62768 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751971AbdKENKp (ORCPT ); Sun, 5 Nov 2017 08:10:45 -0500 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() Cc: LKML , kernel-janitors@vger.kernel.org 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= Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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)