Make the envp char array a const in the send_add_uevent function since
the value will never change. It will remain an array of the pointers to
the various char arrays.
There does exist a warning when running the checkpatch script to
make this a static variable, but there does not appear to be any advantage
to make this change.
Signed-off-by: Ian Cowan <ian(a)linux.cowan.aero>
---
drivers/staging/greybus/audio_manager_module.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/greybus/audio_manager_module.c b/drivers/staging/greybus/audio_manager_module.c
index 0a0f0a394c84..c9d223b0e541 100644
--- a/drivers/staging/greybus/audio_manager_module.c
+++ b/drivers/staging/greybus/audio_manager_module.c
@@ -159,7 +159,7 @@ static void send_add_uevent(struct gb_audio_manager_module *module)
char ip_devices_string[64];
char op_devices_string[64];
- char *envp[] = {
+ const char *envp[] = {
name_string,
vid_string,
pid_string,
--
2.32.0
Zero-length and one-element arrays are deprecated. Flexible-array
members should be used instead. Flexible-array members are
recommended because this is the way the kernel expects dynamically
sized trailing elements to be declared.
Refer to Documentation/process/deprecated.rst.
Change the zero-length array, buf, in the struct
gb_usb_hub_control_response to a flexible array. And add wLength as a
member of the struct so that the struct is not a zero-sized struct.
Issue found by flexible_array coccinelle script.
Signed-off-by: Jaehee Park <jhpark1013(a)gmail.com>
---
I have a question for the authors:
I saw a fixme comment in the hub_control function in usb.c:
/ FIXME: handle unspecified lengths /
I was wondering why this comment was left there?
In this patch, I'm using this struct:
struct gb_usb_hub_control_response {
__le16 wLength;
u8 buf[];
};
And instead of using response_size, I'm doing this:
struct gb_usb_hub_control_response *response;
And using sizeof(*response) as the input to gb_operation_create.
Would the flexible array address the handling of unspecified lengths
issue (in the fixme comment)?
drivers/staging/greybus/usb.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/greybus/usb.c b/drivers/staging/greybus/usb.c
index 8e9d9d59a357..d0b2422401df 100644
--- a/drivers/staging/greybus/usb.c
+++ b/drivers/staging/greybus/usb.c
@@ -27,7 +27,8 @@ struct gb_usb_hub_control_request {
};
struct gb_usb_hub_control_response {
- u8 buf[0];
+ __le16 wLength;
+ u8 buf[];
};
struct gb_usb_device {
@@ -102,16 +103,14 @@ static int hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex,
struct gb_operation *operation;
struct gb_usb_hub_control_request *request;
struct gb_usb_hub_control_response *response;
- size_t response_size;
int ret;
/* FIXME: handle unspecified lengths */
- response_size = sizeof(*response) + wLength;
operation = gb_operation_create(dev->connection,
GB_USB_TYPE_HUB_CONTROL,
sizeof(*request),
- response_size,
+ sizeof(*response),
GFP_KERNEL);
if (!operation)
return -ENOMEM;
--
2.25.1
The first patch corrects a typo in a comment. The second patch removes
an unneeded return.
Changes in version 2:
- edited the subject to be more concise.
- edited the log message to be more descriptive.
Jaehee Park (2):
staging: greybus: correct typo in comment
staging: greybus: remove unneeded return
drivers/staging/greybus/arche-apb-ctrl.c | 2 +-
drivers/staging/greybus/audio_codec.c | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
--
2.25.1
The first patch corrects a typo in a comment. The second patch fixes
'void function return statements are not generally useful' warning.
Jaehee Park (2):
staging: greybus: correct typo in comment 'Atleast' to 'At least'
staging: greybus: remove return in an empty void function
drivers/staging/greybus/arche-apb-ctrl.c | 2 +-
drivers/staging/greybus/audio_codec.c | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
--
2.25.1
Correct spelling typo.
Signed-off-by: Jaehee Park <jhpark1013(a)gmail.com>
---
drivers/staging/greybus/arche-apb-ctrl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/greybus/arche-apb-ctrl.c b/drivers/staging/greybus/arche-apb-ctrl.c
index bbf3ba744fc4..45afa208d004 100644
--- a/drivers/staging/greybus/arche-apb-ctrl.c
+++ b/drivers/staging/greybus/arche-apb-ctrl.c
@@ -445,7 +445,7 @@ static int __maybe_unused arche_apb_ctrl_suspend(struct device *dev)
static int __maybe_unused arche_apb_ctrl_resume(struct device *dev)
{
/*
- * Atleast for ES2 we have to meet the delay requirement between
+ * At least for ES2 we have to meet the delay requirement between
* unipro switch and AP bridge init, depending on whether bridge is in
* OFF state or standby state.
*
--
2.25.1
Since commit f9a8ee8c8bcd ("pwm: Always allocate PWM chip base ID
dynamically") the value held in base isn't used any more in the PWM
framework. All PMWs get assigned a dynamic ID, so the assignment is
redundant and can be dropped.
Reviewed-by: Johan Hovold <johan(a)kernel.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig(a)pengutronix.de>
---
Hello,
changes since (implicit) v1:
- Add "pwm: " to Subject
- Add Reviewed-by:-tag for Johan
Best regards
Uwe
drivers/staging/greybus/pwm.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/staging/greybus/pwm.c b/drivers/staging/greybus/pwm.c
index ad20ec24031e..3fda172239d2 100644
--- a/drivers/staging/greybus/pwm.c
+++ b/drivers/staging/greybus/pwm.c
@@ -297,7 +297,6 @@ static int gb_pwm_probe(struct gbphy_device *gbphy_dev,
pwm->dev = &gbphy_dev->dev;
pwm->ops = &gb_pwm_ops;
- pwm->base = -1; /* Allocate base dynamically */
pwm->npwm = pwmc->pwm_max + 1;
ret = pwmchip_add(pwm);
base-commit: 3123109284176b1532874591f7c81f3837bbdc17
--
2.35.1
Since commit f9a8ee8c8bcd ("pwm: Always allocate PWM chip base ID
dynamically") the value held in base isn't used any more in the PWM
framework. All PMWs get assigned a dynamic ID, so the assignment is
redundant and can be dropped.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig(a)pengutronix.de>
---
drivers/staging/greybus/pwm.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/staging/greybus/pwm.c b/drivers/staging/greybus/pwm.c
index ad20ec24031e..3fda172239d2 100644
--- a/drivers/staging/greybus/pwm.c
+++ b/drivers/staging/greybus/pwm.c
@@ -297,7 +297,6 @@ static int gb_pwm_probe(struct gbphy_device *gbphy_dev,
pwm->dev = &gbphy_dev->dev;
pwm->ops = &gb_pwm_ops;
- pwm->base = -1; /* Allocate base dynamically */
pwm->npwm = pwmc->pwm_max + 1;
ret = pwmchip_add(pwm);
base-commit: 3123109284176b1532874591f7c81f3837bbdc17
--
2.35.1
These three bugs are here:
struct gbaudio_data_connection *data;
If the list '&codec->module_list' is empty then the 'data' will
keep unchanged. However, the 'data' is not initialized and filled
with trash value. As a result, if the value is not NULL, the check
'if (!data) {' will always be false and never exit expectly.
To fix these bug, just initialize 'data' with NULL.
Cc: stable(a)vger.kernel.org
Fixes: 6dd67645f22cf ("greybus: audio: Use single codec driver registration")
Signed-off-by: Xiaomeng Tong <xiam0nd.tong(a)gmail.com>
---
drivers/staging/greybus/audio_codec.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c
index b589cf6b1d03..939e05af4dcf 100644
--- a/drivers/staging/greybus/audio_codec.c
+++ b/drivers/staging/greybus/audio_codec.c
@@ -397,7 +397,7 @@ static int gbcodec_hw_params(struct snd_pcm_substream *substream,
u8 sig_bits, channels;
u32 format, rate;
struct gbaudio_module_info *module;
- struct gbaudio_data_connection *data;
+ struct gbaudio_data_connection *data = NULL;
struct gb_bundle *bundle;
struct gbaudio_codec_info *codec = dev_get_drvdata(dai->dev);
struct gbaudio_stream_params *params;
@@ -498,7 +498,7 @@ static int gbcodec_prepare(struct snd_pcm_substream *substream,
{
int ret;
struct gbaudio_module_info *module;
- struct gbaudio_data_connection *data;
+ struct gbaudio_data_connection *data = NULL;
struct gb_bundle *bundle;
struct gbaudio_codec_info *codec = dev_get_drvdata(dai->dev);
struct gbaudio_stream_params *params;
@@ -562,7 +562,7 @@ static int gbcodec_prepare(struct snd_pcm_substream *substream,
static int gbcodec_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
{
int ret;
- struct gbaudio_data_connection *data;
+ struct gbaudio_data_connection *data = NULL;
struct gbaudio_module_info *module;
struct gb_bundle *bundle;
struct gbaudio_codec_info *codec = dev_get_drvdata(dai->dev);
--
2.17.1
If the list does not exit early then data == NULL and 'module' does not
point to a valid list element.
Using 'module' in such a case is not valid and was therefore removed.
Fixes: 6dd67645f22c ("greybus: audio: Use single codec driver registration")
Signed-off-by: Jakob Koschel <jakobkoschel(a)gmail.com>
---
drivers/staging/greybus/audio_codec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c
index b589cf6b1d03..e19b91e7a72e 100644
--- a/drivers/staging/greybus/audio_codec.c
+++ b/drivers/staging/greybus/audio_codec.c
@@ -599,8 +599,8 @@ static int gbcodec_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
break;
}
if (!data) {
- dev_err(dai->dev, "%s:%s DATA connection missing\n",
- dai->name, module->name);
+ dev_err(dai->dev, "%s DATA connection missing\n",
+ dai->name);
mutex_unlock(&codec->lock);
return -ENODEV;
}
base-commit: f443e374ae131c168a065ea1748feac6b2e76613
--
2.25.1