From patchwork Sun Sep 12 13:37:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gaston Gonzalez X-Patchwork-Id: 12486923 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 24066C433F5 for ; Sun, 12 Sep 2021 13:40:42 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D847A610A6 for ; Sun, 12 Sep 2021 13:40:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D847A610A6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=soK3BhmKKzRL3N3JvUF32kzXLiZulpVw1/fL2NOekw8=; b=OVwWdZox/yW8gD i9vpiNOHYQ9WtJFbrpWadASfQK8fUQeWAbImkGnqD4FA8aHM/GrcuJmXvHOG39IoVg+8DCmYlVV/R VqZwPnVMLlWHDcfMz7Up0ojXa1USWVkGAECMO6Tq7UyYF0FsV9HATzbZJxoQ9cTYyGldbhUHxmhzr s9U01ZCeQo1SnpXel2OvgKku6gBv9lUhRCdEl4ZX1VtQjET35IazBEJFoqObbsOjDgFT3j0d9+KRI 5VxpNLqb+rt7Hd4OAQg99p+qicrV4kgDzqMZpD4pNjeBK8hXWMDlNGUE5O6onGKapqXhWeNNo9Lfn tmSsT2o+7OcjeWaYYCtg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mPPhE-00GTtx-SX; Sun, 12 Sep 2021 13:39:01 +0000 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mPPh9-00GTsw-Hz; Sun, 12 Sep 2021 13:38:57 +0000 Received: by mail-oi1-x230.google.com with SMTP id q39so10378238oiw.12; Sun, 12 Sep 2021 06:38:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=O5ZWGZmPnammQ04Toa5uVC3kIpyJsyrgJg39bwT6488=; b=IOsk+hvpEYnvUmtgxv+3zhefOSuJqSbkV8JnhMqNpoTFlAAny766aYeMs8aeaJFIq+ QbNjJAYcaSiQjoe1FlgTeW96zaKBwZHshnt1D1UTgvydoQVoG7p63L02AHtlsB5OW7lz 7YEGRX/AUsVkHQJixisAHwGbcTD/K2DbP8IBz+huCSFzEp+xn+CB6uiCr5clFuvLmJti ix2TWb0CqP8xyK+zvvMuN0f3TVLVB/hcTOTrP4nWEkmT6eCWikHzwPAaG2TuoPnBYm5F R7mXYhfh4XD/XqKsYGqhvA3MxV19N1s+WqWJikojfCXIx+IQyMgO3/2EqtwV8RJkGIvH +XFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=O5ZWGZmPnammQ04Toa5uVC3kIpyJsyrgJg39bwT6488=; b=LbiGZeLZghQRfHLFfcTUqsdRfWVeYDGPYuDzAtBYGtA6wYgiJlsrSY06q6qP5Nwq0u tMquKVu5pqiV4wNWQAL8ilIolhzKeEQYAKkIBtlaaUzUP6A/7omXeb8W2h1snWo8ueNn A24pzDZeVLK1ZBs2j2NZZvW1TCXMN2QB3vrHnuMQ15Vp3nKBLbBiJvxi7594obHNZT5C VozaY5G1gZ9RPhZ/7YIIC0StWQ4UTB4tots8zsRI3YTBhlft2Yle+02WFTeREUJYmefk KL1CP4E54lym+2c0rTS8Tjvg4/sxmf3xMPiOah10JPN8ZH07QvlvimsYF/yvk1ELZZPz PinA== X-Gm-Message-State: AOAM533VheueXOy40ovTJUOtyfOAH4Yq1rOt46CiBLKevYJH3jMe6VS+ YVfBdJcYIMe68mZvipri9UQ= X-Google-Smtp-Source: ABdhPJyAVNxu9oL4gcklUE+FcSb5eLgLwLCJZhG3eBTWK+U1uAqSp4QI/5iiwnXlQW7Q+YgqGgwL6Q== X-Received: by 2002:a05:6808:1910:: with SMTP id bf16mr4617945oib.56.1631453931619; Sun, 12 Sep 2021 06:38:51 -0700 (PDT) Received: from localhost.localdomain ([191.84.239.65]) by smtp.gmail.com with ESMTPSA id a15sm1131853otq.13.2021.09.12.06.38.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Sep 2021 06:38:51 -0700 (PDT) From: Gaston Gonzalez To: linux-staging@lists.linux.dev Cc: gregkh@linuxfoundation.org, nsaenz@kernel.org, stefan.wahren@i2se.com, arnd@arndb.de, dan.carpenter@oracle.com, ojaswin98@gmail.com, phil@raspberrypi.com, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, gascoar@gmail.com Subject: [PATCH 1/2] staging: vchiq_dev: remove braces from if block Date: Sun, 12 Sep 2021 10:37:50 -0300 Message-Id: <20210912133751.269885-1-gascoar@gmail.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210912_063855_652282_598C2A35 X-CRM114-Status: UNSURE ( 9.14 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Remove unnecessary braces from if block. Reported by checkpatch.pl Signed-off-by: Gaston Gonzalez --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c index 788fa5a987a3..c990d5d7bfb5 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c @@ -447,9 +447,8 @@ static int vchiq_ioc_await_completion(struct vchiq_instance *instance, DEBUG_INITIALISE(g_state.local) DEBUG_TRACE(AWAIT_COMPLETION_LINE); - if (!instance->connected) { + if (!instance->connected) return -ENOTCONN; - } mutex_lock(&instance->completion_mutex); From patchwork Sun Sep 12 13:37:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gaston Gonzalez X-Patchwork-Id: 12486925 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 3E1F8C433F5 for ; Sun, 12 Sep 2021 13:41:22 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 088CE610FD for ; Sun, 12 Sep 2021 13:41:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 088CE610FD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=57fI4m28F8BAAa6vSCQQNvYTRC16QBmjD+EwSAxckdE=; b=cooNd9SuErbhMZ CV9KTQXVpG4kLChm7k7OCY3PGVHhebYzQnexmBgd5rCM5m/YM23oZHPGnmMnTQ6XS7qPqCpNYwvKi EouZ1L+gFtbV07LyBItSQ2cPzHtUHKV3XgnsNFQ+TtBO5gRdcj7I9MszJe3IJGBrQMsQZLkNTS9cm sD9ZsWaLT+bndSpQQ1j6y5ujjfSFmH707j4IfY4TU9zcn9zDLvP9sFY6uh2G8h2WkF1aa3Bef+WmN 77dmfW9uDbFF3CcDHKRQb3oH5jTLeJHkr+sOXYSxoBN5SfPuojmOvDVE/VfL/BI2fYJnDzrEX8BVW 8feQYWwjHMWGiDyyz00Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mPPht-00GU0D-69; Sun, 12 Sep 2021 13:39:41 +0000 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mPPho-00GTyj-CT; Sun, 12 Sep 2021 13:39:38 +0000 Received: by mail-oi1-x231.google.com with SMTP id h133so10437849oib.7; Sun, 12 Sep 2021 06:39:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=M7r44wAX+qmiizcGaAxSCKCWdtDrp690Qges1PulPjg=; b=TKBXlG7eLSw+7nDVL3FBRktgm8gdSxaQPR2DEYRqRDfpZ+hhq1H32k0YwNhNP7x/p0 OBb1s3ktyejHRc95xCvLVM3ni79y7gNhp38Ok6t7epweSkQRoDUARBb9Ksat2a3TbKDW +XLJtIx2x1Y6vpNCKL+d2ovuZ1b8cfgaKCmVQcfV0uFvf5O0NciFWLn4P8X8llx05M3D 73+NLPMGYeHd76rXhWlcNuRDF/QrSg/+JjAVPd+xTevy3Rwrxyp1tRB+OgcVKrk3YD0D SHVFfLGLyEY6R3y/S1e1PrPSwrIjWwAjb3E1WRnm6vAeAWqHqsDUadUe5+S3+UZUTUaw r9gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=M7r44wAX+qmiizcGaAxSCKCWdtDrp690Qges1PulPjg=; b=QuwyHPk+8w34Xvm4dGuQb9NV8+8+muDETpMvE3Q7FQo3VwscWU2f4DdbIkwWGy0Plh e9hcqx55hVo2GWkJp0oeJ6vX4D/TqLySdp6sd0j0pu8IGDVp/jrF4kiZZL5wubmwl5ED 2904U2W85+I7r+DOpg6L5r/omk96JCa3MWNXS5FZsb/mCa+I9tqlpdo0Tb6Gj9S8JCU9 Y1l3ac6fMrOeLI9JjSUangt/OKQ9kjgP7R1ZsSUcDKen1Vfdz2W2epQem8s2jN+Z4Sn9 J4BD3f67sXFxVCOZ4tlp2FoX+vyB22i4Vyia+r7V3s3xGuS9As+6Q0xRafowca1GZ1Xp 8p4w== X-Gm-Message-State: AOAM5327CWDoaUSh/C+1mceaxZWJtuk+TxYtTvk3C4Sj4SXk2B3BRqEA O1hwtHc+jbWQ2wkekgvKLYc= X-Google-Smtp-Source: ABdhPJwTBJ22NGsb4ghX4HGVfKpZD0QPQHlj7I++TA2m8z2nR+gbon2UWIPfzNmX8BxyiEzJnF/n7A== X-Received: by 2002:a05:6808:2114:: with SMTP id r20mr4813048oiw.110.1631453975486; Sun, 12 Sep 2021 06:39:35 -0700 (PDT) Received: from localhost.localdomain ([191.84.239.65]) by smtp.gmail.com with ESMTPSA id a15sm1131853otq.13.2021.09.12.06.39.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Sep 2021 06:39:35 -0700 (PDT) From: Gaston Gonzalez To: linux-staging@lists.linux.dev Cc: gregkh@linuxfoundation.org, nsaenz@kernel.org, stefan.wahren@i2se.com, arnd@arndb.de, dan.carpenter@oracle.com, ojaswin98@gmail.com, phil@raspberrypi.com, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, gascoar@gmail.com Subject: [PATCH 2/2] staging: vchiq_dev: cleanup code alignment issues Date: Sun, 12 Sep 2021 10:37:52 -0300 Message-Id: <20210912133751.269885-2-gascoar@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210912133751.269885-1-gascoar@gmail.com> References: <20210912133751.269885-1-gascoar@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210912_063936_479562_B18CF8B5 X-CRM114-Status: GOOD ( 16.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Fix code alignment issues. Reported by checkpatch.pl Signed-off-by: Gaston Gonzalez --- .../interface/vchiq_arm/vchiq_dev.c | 104 +++++++----------- 1 file changed, 42 insertions(+), 62 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c index c990d5d7bfb5..32aa1e62450d 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c @@ -48,8 +48,8 @@ user_service_free(void *userdata) static void close_delivered(struct user_service *user_service) { vchiq_log_info(vchiq_arm_log_level, - "%s(handle=%x)", - __func__, user_service->service->handle); + "%s(handle=%x)", + __func__, user_service->service->handle); if (user_service->close_pending) { /* Allow the underlying service to be culled */ @@ -90,8 +90,8 @@ static ssize_t vchiq_ioc_copy_element_data(void *context, void *dest, maxsize - total_bytes_copied); if (copy_from_user(dest + total_bytes_copied, - cc->element->data + cc->element_offset, - bytes_this_round)) + cc->element->data + cc->element_offset, + bytes_this_round)) return -EFAULT; cc->element_offset += bytes_this_round; @@ -235,10 +235,9 @@ static int vchiq_ioc_dequeue_message(struct vchiq_instance *instance, do { spin_unlock(&msg_queue_spinlock); DEBUG_TRACE(DEQUEUE_MESSAGE_LINE); - if (wait_for_completion_interruptible( - &user_service->insert_event)) { + if (wait_for_completion_interruptible(&user_service->insert_event)) { vchiq_log_info(vchiq_arm_log_level, - "DEQUEUE_MESSAGE interrupted"); + "DEQUEUE_MESSAGE interrupted"); ret = -EINTR; break; } @@ -266,8 +265,7 @@ static int vchiq_ioc_dequeue_message(struct vchiq_instance *instance, ret = -ENOTCONN; } else if (header->size <= args->bufsize) { /* Copy to user space if msgbuf is not NULL */ - if (!args->buf || (copy_to_user(args->buf, - header->data, header->size) == 0)) { + if (!args->buf || (copy_to_user(args->buf, header->data, header->size) == 0)) { ret = header->size; vchiq_release_message(service->handle, header); } else { @@ -275,8 +273,8 @@ static int vchiq_ioc_dequeue_message(struct vchiq_instance *instance, } } else { vchiq_log_error(vchiq_arm_log_level, - "header %pK: bufsize %x < size %x", - header, args->bufsize, header->size); + "header %pK: bufsize %x < size %x", + header, args->bufsize, header->size); WARN(1, "invalid size\n"); ret = -EMSGSIZE; } @@ -323,14 +321,12 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance, mutex_unlock(&instance->bulk_waiter_list_mutex); if (!found) { vchiq_log_error(vchiq_arm_log_level, - "no bulk_waiter found for pid %d", - current->pid); + "no bulk_waiter found for pid %d", current->pid); ret = -ESRCH; goto out; } vchiq_log_info(vchiq_arm_log_level, - "found bulk_waiter %pK for pid %d", waiter, - current->pid); + "found bulk_waiter %pK for pid %d", waiter, current->pid); userdata = &waiter->bulk_waiter; } else { userdata = args->userdata; @@ -345,7 +341,7 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance, } if ((status != VCHIQ_RETRY) || fatal_signal_pending(current) || - !waiter->bulk_waiter.bulk) { + !waiter->bulk_waiter.bulk) { if (waiter->bulk_waiter.bulk) { /* Cancel the signal when the transfer completes. */ spin_lock(&bulk_waiter_spinlock); @@ -362,8 +358,7 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance, list_add(&waiter->list, &instance->bulk_waiter_list); mutex_unlock(&instance->bulk_waiter_list_mutex); vchiq_log_info(vchiq_arm_log_level, - "saved bulk_waiter %pK for pid %d", - waiter, current->pid); + "saved bulk_waiter %pK for pid %d", waiter, current->pid); ret = put_user(mode_waiting, mode); } @@ -453,19 +448,17 @@ static int vchiq_ioc_await_completion(struct vchiq_instance *instance, mutex_lock(&instance->completion_mutex); DEBUG_TRACE(AWAIT_COMPLETION_LINE); - while ((instance->completion_remove == instance->completion_insert) - && !instance->closing) { + while ((instance->completion_remove == instance->completion_insert) && !instance->closing) { int rc; DEBUG_TRACE(AWAIT_COMPLETION_LINE); mutex_unlock(&instance->completion_mutex); - rc = wait_for_completion_interruptible( - &instance->insert_event); + rc = wait_for_completion_interruptible(&instance->insert_event); mutex_lock(&instance->completion_mutex); if (rc) { DEBUG_TRACE(AWAIT_COMPLETION_LINE); vchiq_log_info(vchiq_arm_log_level, - "AWAIT_COMPLETION interrupted"); + "AWAIT_COMPLETION interrupted"); ret = -EINTR; goto out; } @@ -485,8 +478,7 @@ static int vchiq_ioc_await_completion(struct vchiq_instance *instance, if (remove == instance->completion_insert) break; - completion = &instance->completions[ - remove & (MAX_COMPLETIONS - 1)]; + completion = &instance->completions[remove & (MAX_COMPLETIONS - 1)]; /* * A read memory barrier is needed to stop @@ -512,9 +504,9 @@ static int vchiq_ioc_await_completion(struct vchiq_instance *instance, /* This must be a VCHIQ-style service */ if (args->msgbufsize < msglen) { vchiq_log_error(vchiq_arm_log_level, - "header %pK: msgbufsize %x < msglen %x", - header, args->msgbufsize, msglen); - WARN(1, "invalid message size\n"); + "header %pK: msgbufsize %x < msglen %x", + header, args->msgbufsize, msglen); + WARN(1, "invalid message size\n"); if (ret == 0) ret = -EMSGSIZE; break; @@ -525,7 +517,7 @@ static int vchiq_ioc_await_completion(struct vchiq_instance *instance, /* Get the pointer from user space */ msgbufcount--; if (vchiq_get_user_ptr(&msgbuf, args->msgbufs, - msgbufcount)) { + msgbufcount)) { if (ret == 0) ret = -EFAULT; break; @@ -593,11 +585,9 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) int i, rc; vchiq_log_trace(vchiq_arm_log_level, - "%s - instance %pK, cmd %s, arg %lx", - __func__, instance, - ((_IOC_TYPE(cmd) == VCHIQ_IOC_MAGIC) && - (_IOC_NR(cmd) <= VCHIQ_IOC_MAX)) ? - ioctl_names[_IOC_NR(cmd)] : "", arg); + "%s - instance %pK, cmd %s, arg %lx", __func__, instance, + ((_IOC_TYPE(cmd) == VCHIQ_IOC_MAGIC) && (_IOC_NR(cmd) <= VCHIQ_IOC_MAX)) ? + ioctl_names[_IOC_NR(cmd)] : "", arg); switch (cmd) { case VCHIQ_IOC_SHUTDOWN: @@ -607,7 +597,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) /* Remove all services */ i = 0; while ((service = next_service_by_instance(instance->state, - instance, &i))) { + instance, &i))) { status = vchiq_remove_service(service->handle); vchiq_service_put(service); if (status != VCHIQ_SUCCESS) @@ -631,8 +621,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) rc = mutex_lock_killable(&instance->state->mutex); if (rc) { vchiq_log_error(vchiq_arm_log_level, - "vchiq: connect: could not lock mutex for state %d: %d", - instance->state->id, rc); + "vchiq: connect: could not lock mutex for state %d: %d", + instance->state->id, rc); ret = -EINTR; break; } @@ -643,7 +633,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) instance->connected = 1; else vchiq_log_error(vchiq_arm_log_level, - "vchiq: could not connect: %d", status); + "vchiq: could not connect: %d", status); break; case VCHIQ_IOC_CREATE_SERVICE: { @@ -697,8 +687,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) * CLOSE_DELIVERED ioctl, signalling close_event. */ if (user_service->close_pending && - wait_for_completion_interruptible( - &user_service->close_event)) + wait_for_completion_interruptible(&user_service->close_event)) status = VCHIQ_RETRY; break; } @@ -714,14 +703,12 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) vchiq_release_service_internal(service); if (ret) { vchiq_log_error(vchiq_susp_log_level, - "%s: cmd %s returned error %ld for service %c%c%c%c:%03d", - __func__, - (cmd == VCHIQ_IOC_USE_SERVICE) ? + "%s: cmd %s returned error %ld for service %c%c%c%c:%03d", + __func__, (cmd == VCHIQ_IOC_USE_SERVICE) ? "VCHIQ_IOC_USE_SERVICE" : "VCHIQ_IOC_RELEASE_SERVICE", ret, - VCHIQ_FOURCC_AS_4CHARS( - service->base.fourcc), + VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc), service->client_id); } } else { @@ -745,7 +732,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) struct vchiq_element elements[MAX_ELEMENTS]; if (copy_from_user(elements, args.elements, - args.count * sizeof(struct vchiq_element)) == 0) + args.count * sizeof(struct vchiq_element)) == 0) ret = vchiq_ioc_queue_message(args.handle, elements, args.count); else @@ -883,23 +870,16 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ret = -EINTR; } - if ((status == VCHIQ_SUCCESS) && (ret < 0) && (ret != -EINTR) && - (ret != -EWOULDBLOCK)) + if ((status == VCHIQ_SUCCESS) && (ret < 0) && (ret != -EINTR) && (ret != -EWOULDBLOCK)) vchiq_log_info(vchiq_arm_log_level, - " ioctl instance %pK, cmd %s -> status %d, %ld", - instance, - (_IOC_NR(cmd) <= VCHIQ_IOC_MAX) ? - ioctl_names[_IOC_NR(cmd)] : - "", - status, ret); + " ioctl instance %pK, cmd %s -> status %d, %ld", + instance, (_IOC_NR(cmd) <= VCHIQ_IOC_MAX) ? + ioctl_names[_IOC_NR(cmd)] : "", status, ret); else vchiq_log_trace(vchiq_arm_log_level, - " ioctl instance %pK, cmd %s -> status %d, %ld", - instance, - (_IOC_NR(cmd) <= VCHIQ_IOC_MAX) ? - ioctl_names[_IOC_NR(cmd)] : - "", - status, ret); + " ioctl instance %pK, cmd %s -> status %d, %ld", + instance, (_IOC_NR(cmd) <= VCHIQ_IOC_MAX) ? + ioctl_names[_IOC_NR(cmd)] : "", status, ret); return ret; } @@ -1297,8 +1277,8 @@ static int vchiq_release(struct inode *inode, struct file *file) struct vchiq_completion_data_kernel *completion; struct vchiq_service *service; - completion = &instance->completions[ - instance->completion_remove & (MAX_COMPLETIONS - 1)]; + completion = &instance->completions[instance->completion_remove + & (MAX_COMPLETIONS - 1)]; service = completion->service_userdata; if (completion->reason == VCHIQ_SERVICE_CLOSED) { struct user_service *user_service =