From patchwork Tue Dec 29 10:18:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 7929401 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BAD899F349 for ; Tue, 29 Dec 2015 10:19:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DEE9C2021A for ; Tue, 29 Dec 2015 10:19:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7562F201EC for ; Tue, 29 Dec 2015 10:19:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752024AbbL2KTH (ORCPT ); Tue, 29 Dec 2015 05:19:07 -0500 Received: from mout.web.de ([212.227.15.4]:52246 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750906AbbL2KTF (ORCPT ); Tue, 29 Dec 2015 05:19:05 -0500 Received: from [192.168.1.2] ([77.181.55.103]) by smtp.web.de (mrweb004) with ESMTPSA (Nemesis) id 0M22Sh-1ZyFHz0JQp-00u1WA; Tue, 29 Dec 2015 11:18:52 +0100 Subject: [PATCH] [media] hdpvr: Refactoring for hdpvr_read() References: <566ABCD9.1060404@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall To: linux-media@vger.kernel.org, Hans Verkuil , Mauro Carvalho Chehab From: SF Markus Elfring X-Enigmail-Draft-Status: N1110 Message-ID: <56825E06.6040708@users.sourceforge.net> Date: Tue, 29 Dec 2015 11:18:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0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yyg iTCIgN2kn4MRe+tqKV9tjJOIUYXDvl7ksOauCln6wmI2yyjwpxpAXb5xfaTpnCVrrQgpET+uh qDx7EvEM3ePfn+FD1BUpJUdhaQ16g== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Tue, 29 Dec 2015 11:02:43 +0100 Let us return directly if the element "status" of the variable "buf" indicates "BUFSTAT_READY". A check repetition can be excluded for the variable "ret" at the end then. Signed-off-by: Markus Elfring --- drivers/media/usb/hdpvr/hdpvr-video.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpvr/hdpvr-video.c index 7dee22d..ba7f022 100644 --- a/drivers/media/usb/hdpvr/hdpvr-video.c +++ b/drivers/media/usb/hdpvr/hdpvr-video.c @@ -462,10 +462,8 @@ static ssize_t hdpvr_read(struct file *file, char __user *buffer, size_t count, } if (wait_event_interruptible(dev->wait_data, - buf->status == BUFSTAT_READY)) { - ret = -ERESTARTSYS; - goto err; - } + buf->status == BUFSTAT_READY)) + return -ERESTARTSYS; } if (buf->status != BUFSTAT_READY)