From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
To: stefan.wahren@i2se.com, eric@anholt.net, dave.stevenson@raspberrypi.org
Cc: linux-rpi-kernel@lists.infradead.org, gregkh@linuxfoundation.org,
linux-arm-kernel@lists.infradead.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org,
Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Subject: [PATCH 08/16] staging: vchiq_core: remove unnecessary safety checks in vchiq_init_state
Date: Wed, 14 Nov 2018 13:59:34 +0100 [thread overview]
Message-ID: <20181114125942.25163-9-nsaenzjulienne@suse.de> (raw)
In-Reply-To: <20181114125942.25163-1-nsaenzjulienne@suse.de>
vchiq_init_state() checks the initial contents of slot_zero are correct.
These are set in vchiq_init_slots(), using the same hard-coded defaults
as the checks. Both functions are called sequentially and Video Core
isn't yet aware of the slot's address. There is no way the contents of
slot_zero changed in between functions, making the checks useless.
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
.../interface/vchiq_arm/vchiq_core.c | 59 -------------------
1 file changed, 59 deletions(-)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index 34a892011296..dee5ea7bfe4f 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -2170,65 +2170,6 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero)
return VCHIQ_ERROR;
}
- /* Check the input configuration */
-
- if (slot_zero->magic != VCHIQ_MAGIC) {
- vchiq_loud_error_header();
- vchiq_loud_error("Invalid VCHIQ magic value found.");
- vchiq_loud_error("slot_zero=%pK: magic=%x (expected %x)",
- slot_zero, slot_zero->magic, VCHIQ_MAGIC);
- vchiq_loud_error_footer();
- return VCHIQ_ERROR;
- }
-
- if (slot_zero->version < VCHIQ_VERSION_MIN) {
- vchiq_loud_error_header();
- vchiq_loud_error("Incompatible VCHIQ versions found.");
- vchiq_loud_error("slot_zero=%pK: VideoCore version=%d (minimum %d)",
- slot_zero, slot_zero->version, VCHIQ_VERSION_MIN);
- vchiq_loud_error("Restart with a newer VideoCore image.");
- vchiq_loud_error_footer();
- return VCHIQ_ERROR;
- }
-
- if (VCHIQ_VERSION < slot_zero->version_min) {
- vchiq_loud_error_header();
- vchiq_loud_error("Incompatible VCHIQ versions found.");
- vchiq_loud_error("slot_zero=%pK: version=%d (VideoCore minimum %d)",
- slot_zero, VCHIQ_VERSION, slot_zero->version_min);
- vchiq_loud_error("Restart with a newer kernel.");
- vchiq_loud_error_footer();
- return VCHIQ_ERROR;
- }
-
- if ((slot_zero->slot_zero_size != sizeof(VCHIQ_SLOT_ZERO_T)) ||
- (slot_zero->slot_size != VCHIQ_SLOT_SIZE) ||
- (slot_zero->max_slots != VCHIQ_MAX_SLOTS) ||
- (slot_zero->max_slots_per_side != VCHIQ_MAX_SLOTS_PER_SIDE)) {
- vchiq_loud_error_header();
- if (slot_zero->slot_zero_size != sizeof(VCHIQ_SLOT_ZERO_T))
- vchiq_loud_error("slot_zero=%pK: slot_zero_size=%d (expected %d)",
- slot_zero, slot_zero->slot_zero_size,
- (int)sizeof(VCHIQ_SLOT_ZERO_T));
- if (slot_zero->slot_size != VCHIQ_SLOT_SIZE)
- vchiq_loud_error("slot_zero=%pK: slot_size=%d (expected %d)",
- slot_zero, slot_zero->slot_size,
- VCHIQ_SLOT_SIZE);
- if (slot_zero->max_slots != VCHIQ_MAX_SLOTS)
- vchiq_loud_error("slot_zero=%pK: max_slots=%d (expected %d)",
- slot_zero, slot_zero->max_slots,
- VCHIQ_MAX_SLOTS);
- if (slot_zero->max_slots_per_side != VCHIQ_MAX_SLOTS_PER_SIDE)
- vchiq_loud_error("slot_zero=%pK: max_slots_per_side=%d (expected %d)",
- slot_zero, slot_zero->max_slots_per_side,
- VCHIQ_MAX_SLOTS_PER_SIDE);
- vchiq_loud_error_footer();
- return VCHIQ_ERROR;
- }
-
- if (VCHIQ_VERSION < slot_zero->version)
- slot_zero->version = VCHIQ_VERSION;
-
local = &slot_zero->slave;
remote = &slot_zero->master;
--
2.19.1
next prev parent reply other threads:[~2018-11-14 13:01 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-14 12:59 [PATCH 00/16] staging: vchiq: dead code removal & misc fixes Nicolas Saenz Julienne
2018-11-14 12:59 ` [PATCH 01/16] staging: vchiq_core: rework vchiq_get_config Nicolas Saenz Julienne
2018-11-14 12:59 ` [PATCH 02/16] staging: vchiq_arm: rework close/remove_service IOCTLS Nicolas Saenz Julienne
2018-11-14 12:59 ` [PATCH 03/16] staging: vchiq_shim: delete vchi_service_create Nicolas Saenz Julienne
2018-11-14 12:59 ` [PATCH 04/16] staging: vchiq_arm: use list_for_each_entry when accessing bulk_waiter_list Nicolas Saenz Julienne
2018-11-14 12:59 ` [PATCH 05/16] staging: vchiq_arm: get rid of vchi_mh.h Nicolas Saenz Julienne
2018-11-14 12:59 ` [PATCH 06/16] staging: vchiq_arm: rework vchiq_ioc_copy_element_data Nicolas Saenz Julienne
2018-11-14 12:59 ` [PATCH 07/16] staging: vchiq-core: get rid of is_master distinction Nicolas Saenz Julienne
2018-11-14 12:59 ` Nicolas Saenz Julienne [this message]
2018-11-14 12:59 ` [PATCH 09/16] staging: vchiq_core: do not initialize semaphores twice Nicolas Saenz Julienne
2018-11-14 12:59 ` [PATCH 10/16] staging: vchiq_core: don't add a wmb() before remote_event_signal() Nicolas Saenz Julienne
2018-11-14 12:59 ` [PATCH 11/16] staging: vchiq: use completions instead of semaphores Nicolas Saenz Julienne
2018-11-14 12:59 ` [PATCH 12/16] staging: vchiq_util: get rid of unneeded memory barriers Nicolas Saenz Julienne
2018-11-14 12:59 ` [PATCH 13/16] staging: vchiq_core: fix logic redundancy in parse_open Nicolas Saenz Julienne
2018-11-14 12:59 ` [PATCH 14/16] staging: vchiq_arm: rework probe and init functions Nicolas Saenz Julienne
2018-11-14 12:59 ` [PATCH 15/16] staging: vchiq_arm: fix open/release cdev functions Nicolas Saenz Julienne
2018-11-14 12:59 ` [PATCH 16/16] staging: vchiq: add more tasks to the TODO list Nicolas Saenz Julienne
2018-11-18 15:55 ` [PATCH 00/16] staging: vchiq: dead code removal & misc fixes Stefan Wahren
2018-11-20 9:57 ` Greg KH
2018-11-20 10:04 ` Nicolas Saenz Julienne
2018-11-20 10:08 ` Stefan Wahren
2018-11-20 14:53 Nicolas Saenz Julienne
2018-11-20 14:53 ` [PATCH 08/16] staging: vchiq_core: remove unnecessary safety checks in vchiq_init_state Nicolas Saenz Julienne
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181114125942.25163-9-nsaenzjulienne@suse.de \
--to=nsaenzjulienne@suse.de \
--cc=dave.stevenson@raspberrypi.org \
--cc=devel@driverdev.osuosl.org \
--cc=eric@anholt.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=stefan.wahren@i2se.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).