* [PATCH V2 0/5] staging: vc04_services: Minor clean-ups
@ 2024-04-25 16:58 Stefan Wahren
2024-04-25 16:58 ` [PATCH V2 1/5] staging: vchiq_arm: Drop unnecessary NULL check Stefan Wahren
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Stefan Wahren @ 2024-04-25 16:58 UTC (permalink / raw)
To: Greg Kroah-Hartman, Florian Fainelli
Cc: Umang Jain, Laurent Pinchart, linux-staging, linux-arm-kernel,
Stefan Wahren
This series contains just minor clean-ups, which were mostly found
by checkpatch.pl or kernel test robot.
Changes in V2:
- Add patch for issue found by kernel test robot
- Fix typo found by Umang
- Add Umangs Reviewed-by
Stefan Wahren (5):
staging: vchiq_arm: Drop unnecessary NULL check
staging: vchiq_core: Use printk messages for devices
staging: vchiq_core: Add parentheses to VCHIQ_MSG_SRCPORT
staging: vchiq_core: Drop unnecessary blank lines
staging: vchiq_core: Add missing blank lines
.../interface/vchiq_arm/vchiq_arm.c | 2 +-
.../interface/vchiq_arm/vchiq_core.c | 16 ++++++++--------
2 files changed, 9 insertions(+), 9 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH V2 1/5] staging: vchiq_arm: Drop unnecessary NULL check
2024-04-25 16:58 [PATCH V2 0/5] staging: vc04_services: Minor clean-ups Stefan Wahren
@ 2024-04-25 16:58 ` Stefan Wahren
2024-04-26 4:22 ` Umang Jain
2024-04-25 16:58 ` [PATCH V2 2/5] staging: vchiq_core: Use printk messages for devices Stefan Wahren
` (3 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: Stefan Wahren @ 2024-04-25 16:58 UTC (permalink / raw)
To: Greg Kroah-Hartman, Florian Fainelli
Cc: Umang Jain, Laurent Pinchart, linux-staging, linux-arm-kernel,
Stefan Wahren, kernel test robot
Looking at the handling of service instance within the VCHIQ
driver shows that it's not possible that service_callback is
called with instance is a NULL pointer. So drop the unnecessary
NULL check and fix:
vchiq_arm.c:1109 service_callback() warn:
variable dereferenced before check 'instance' (see line 1091)
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/linux-arm-kernel/202404230315.vx7ESZ3r-lkp@intel.com/
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index c06232fcb0fb..297af1d80b12 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -1106,7 +1106,7 @@ service_callback(struct vchiq_instance *instance, enum vchiq_reason reason,
user_service = (struct user_service *)service->base.userdata;
- if (!instance || instance->closing) {
+ if (instance->closing) {
rcu_read_unlock();
return 0;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH V2 2/5] staging: vchiq_core: Use printk messages for devices
2024-04-25 16:58 [PATCH V2 0/5] staging: vc04_services: Minor clean-ups Stefan Wahren
2024-04-25 16:58 ` [PATCH V2 1/5] staging: vchiq_arm: Drop unnecessary NULL check Stefan Wahren
@ 2024-04-25 16:58 ` Stefan Wahren
2024-04-25 16:58 ` [PATCH V2 3/5] staging: vchiq_core: Add parentheses to VCHIQ_MSG_SRCPORT Stefan Wahren
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Stefan Wahren @ 2024-04-25 16:58 UTC (permalink / raw)
To: Greg Kroah-Hartman, Florian Fainelli
Cc: Umang Jain, Laurent Pinchart, linux-staging, linux-arm-kernel,
Stefan Wahren
Now that struct vchiq_state has a device reference, we can convert
the remaining printk message helpers.
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
---
.../vc04_services/interface/vchiq_arm/vchiq_core.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 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 3397365e551e..129d73fec2bf 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -697,7 +697,8 @@ reserve_space(struct vchiq_state *state, size_t space, int is_blocking)
if (tx_pos == (state->slot_queue_available * VCHIQ_SLOT_SIZE)) {
complete(&state->slot_available_event);
- pr_warn("%s: invalid tx_pos: %d\n", __func__, tx_pos);
+ dev_warn(state->dev, "%s: invalid tx_pos: %d\n",
+ __func__, tx_pos);
return NULL;
}
@@ -1732,10 +1733,9 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header)
break;
}
if (queue->process != queue->remote_insert) {
- pr_err("%s: p %x != ri %x\n",
- __func__,
- queue->process,
- queue->remote_insert);
+ dev_err(state->dev, "%s: p %x != ri %x\n",
+ __func__, queue->process,
+ queue->remote_insert);
mutex_unlock(&service->bulk_mutex);
goto bail_not_ready;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH V2 3/5] staging: vchiq_core: Add parentheses to VCHIQ_MSG_SRCPORT
2024-04-25 16:58 [PATCH V2 0/5] staging: vc04_services: Minor clean-ups Stefan Wahren
2024-04-25 16:58 ` [PATCH V2 1/5] staging: vchiq_arm: Drop unnecessary NULL check Stefan Wahren
2024-04-25 16:58 ` [PATCH V2 2/5] staging: vchiq_core: Use printk messages for devices Stefan Wahren
@ 2024-04-25 16:58 ` Stefan Wahren
2024-04-25 16:58 ` [PATCH V2 4/5] staging: vchiq_core: Drop unnecessary blank lines Stefan Wahren
2024-04-25 16:58 ` [PATCH V2 5/5] staging: vchiq_core: Add missing " Stefan Wahren
4 siblings, 0 replies; 7+ messages in thread
From: Stefan Wahren @ 2024-04-25 16:58 UTC (permalink / raw)
To: Greg Kroah-Hartman, Florian Fainelli
Cc: Umang Jain, Laurent Pinchart, linux-staging, linux-arm-kernel,
Stefan Wahren
checkpatch.pl complains
ERROR: Macros with complex values should be enclosed in parentheses
+#define VCHIQ_MSG_SRCPORT(msgid) \
+ (unsigned short)(((unsigned int)(msgid) >> 12) & 0xfff)
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
---
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 129d73fec2bf..58451ee08abc 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -43,7 +43,7 @@
(((type) << TYPE_SHIFT) | ((srcport) << 12) | ((dstport) << 0))
#define VCHIQ_MSG_TYPE(msgid) ((unsigned int)(msgid) >> TYPE_SHIFT)
#define VCHIQ_MSG_SRCPORT(msgid) \
- (unsigned short)(((unsigned int)(msgid) >> 12) & 0xfff)
+ ((unsigned short)(((unsigned int)(msgid) >> 12) & 0xfff))
#define VCHIQ_MSG_DSTPORT(msgid) \
((unsigned short)(msgid) & 0xfff)
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH V2 4/5] staging: vchiq_core: Drop unnecessary blank lines
2024-04-25 16:58 [PATCH V2 0/5] staging: vc04_services: Minor clean-ups Stefan Wahren
` (2 preceding siblings ...)
2024-04-25 16:58 ` [PATCH V2 3/5] staging: vchiq_core: Add parentheses to VCHIQ_MSG_SRCPORT Stefan Wahren
@ 2024-04-25 16:58 ` Stefan Wahren
2024-04-25 16:58 ` [PATCH V2 5/5] staging: vchiq_core: Add missing " Stefan Wahren
4 siblings, 0 replies; 7+ messages in thread
From: Stefan Wahren @ 2024-04-25 16:58 UTC (permalink / raw)
To: Greg Kroah-Hartman, Florian Fainelli
Cc: Umang Jain, Laurent Pinchart, linux-staging, linux-arm-kernel,
Stefan Wahren
checkpatch.pl noticed
CHECK: Please don't use multiple blank lines
So drop them.
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
---
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 2 --
1 file changed, 2 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 58451ee08abc..ca32902afe06 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -1190,7 +1190,6 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service,
header->size = size;
header->msgid = msgid;
-
svc_fourcc = service ? service->base.fourcc
: VCHIQ_MAKE_FOURCC('?', '?', '?', '?');
@@ -1616,7 +1615,6 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header)
break;
}
-
svc_fourcc = service ? service->base.fourcc
: VCHIQ_MAKE_FOURCC('?', '?', '?', '?');
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH V2 5/5] staging: vchiq_core: Add missing blank lines
2024-04-25 16:58 [PATCH V2 0/5] staging: vc04_services: Minor clean-ups Stefan Wahren
` (3 preceding siblings ...)
2024-04-25 16:58 ` [PATCH V2 4/5] staging: vchiq_core: Drop unnecessary blank lines Stefan Wahren
@ 2024-04-25 16:58 ` Stefan Wahren
4 siblings, 0 replies; 7+ messages in thread
From: Stefan Wahren @ 2024-04-25 16:58 UTC (permalink / raw)
To: Greg Kroah-Hartman, Florian Fainelli
Cc: Umang Jain, Laurent Pinchart, linux-staging, linux-arm-kernel,
Stefan Wahren
checkpatch.pl noticed about missing blank line after 2 declarations.
So add them for better readability.
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
---
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 2 ++
1 file changed, 2 insertions(+)
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 ca32902afe06..df3af821f218 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -227,6 +227,7 @@ struct vchiq_service *handle_to_service(struct vchiq_instance *instance, unsigne
return rcu_dereference(instance->state->services[idx]);
}
+
struct vchiq_service *
find_service_by_handle(struct vchiq_instance *instance, unsigned int handle)
{
@@ -2176,6 +2177,7 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero, s
for (i = 0; i < VCHIQ_MAX_SERVICES; i++) {
struct vchiq_service_quota *quota = &state->service_quotas[i];
+
init_completion("a->quota_event);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH V2 1/5] staging: vchiq_arm: Drop unnecessary NULL check
2024-04-25 16:58 ` [PATCH V2 1/5] staging: vchiq_arm: Drop unnecessary NULL check Stefan Wahren
@ 2024-04-26 4:22 ` Umang Jain
0 siblings, 0 replies; 7+ messages in thread
From: Umang Jain @ 2024-04-26 4:22 UTC (permalink / raw)
To: Stefan Wahren, Greg Kroah-Hartman, Florian Fainelli
Cc: Laurent Pinchart, linux-staging, linux-arm-kernel, kernel test robot
Hi Stefan,
Thank you for the patch
On 25/04/24 10:28 pm, Stefan Wahren wrote:
> Looking at the handling of service instance within the VCHIQ
> driver shows that it's not possible that service_callback is
> called with instance is a NULL pointer. So drop the unnecessary
> NULL check and fix:
>
> vchiq_arm.c:1109 service_callback() warn:
> variable dereferenced before check 'instance' (see line 1091)
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/linux-arm-kernel/202404230315.vx7ESZ3r-lkp@intel.com/
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
> ---
> drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> index c06232fcb0fb..297af1d80b12 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -1106,7 +1106,7 @@ service_callback(struct vchiq_instance *instance, enum vchiq_reason reason,
>
> user_service = (struct user_service *)service->base.userdata;
>
> - if (!instance || instance->closing) {
> + if (instance->closing) {
> rcu_read_unlock();
> return 0;
> }
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-04-26 4:22 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-25 16:58 [PATCH V2 0/5] staging: vc04_services: Minor clean-ups Stefan Wahren
2024-04-25 16:58 ` [PATCH V2 1/5] staging: vchiq_arm: Drop unnecessary NULL check Stefan Wahren
2024-04-26 4:22 ` Umang Jain
2024-04-25 16:58 ` [PATCH V2 2/5] staging: vchiq_core: Use printk messages for devices Stefan Wahren
2024-04-25 16:58 ` [PATCH V2 3/5] staging: vchiq_core: Add parentheses to VCHIQ_MSG_SRCPORT Stefan Wahren
2024-04-25 16:58 ` [PATCH V2 4/5] staging: vchiq_core: Drop unnecessary blank lines Stefan Wahren
2024-04-25 16:58 ` [PATCH V2 5/5] staging: vchiq_core: Add missing " Stefan Wahren
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).