From c42f736332a43e7cec61f582909036b5addc707a Mon Sep 17 00:00:00 2001 From: Dan Jessie Date: Sat, 28 Mar 2020 18:21:35 -0400 Subject: staging: greybus: hid: remove braces {} around single statement block This patch fixes the checkpatch.pl warning: WARNING: braces {} are not necessary for single statement blocks This is the only instance of the problem noted by checkpatch.pl in staging: greybus. Signed-off-by: Dan Jessie Reviewed-by: Alex Elder Link: https://lore.kernel.org/r/20200328222134.19344-1-dtjessie@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/hid.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging/greybus') diff --git a/drivers/staging/greybus/hid.c b/drivers/staging/greybus/hid.c index 04bfd9110502..ed706f39e87a 100644 --- a/drivers/staging/greybus/hid.c +++ b/drivers/staging/greybus/hid.c @@ -290,9 +290,8 @@ static int gb_hid_parse(struct hid_device *hid) } rdesc = kzalloc(rsize, GFP_KERNEL); - if (!rdesc) { + if (!rdesc) return -ENOMEM; - } ret = gb_hid_get_report_desc(ghid, rdesc); if (ret) { -- cgit v1.2.3-59-g8ed1b From 9bb086e5ba9495ac150fbbcc5c8c2bccc06261dd Mon Sep 17 00:00:00 2001 From: Chen Zhou Date: Wed, 1 Apr 2020 11:00:17 +0800 Subject: staging: greybus: fix a missing-check bug in gb_lights_light_config() In gb_lights_light_config(), 'light->name' is allocated by kstrndup(). It returns NULL when fails, add check for it. Signed-off-by: Chen Zhou Acked-by: Rui Miguel Silva Link: https://lore.kernel.org/r/20200401030017.100274-1-chenzhou10@huawei.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/light.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging/greybus') diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c index d6ba25f21d80..d2672b65c3f4 100644 --- a/drivers/staging/greybus/light.c +++ b/drivers/staging/greybus/light.c @@ -1026,7 +1026,8 @@ static int gb_lights_light_config(struct gb_lights *glights, u8 id) light->channels_count = conf.channel_count; light->name = kstrndup(conf.name, NAMES_MAX, GFP_KERNEL); - + if (!light->name) + return -ENOMEM; light->channels = kcalloc(light->channels_count, sizeof(struct gb_channel), GFP_KERNEL); if (!light->channels) -- cgit v1.2.3-59-g8ed1b From 6064aeefa88c7c1bbb44737db55c5ff83f47718f Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Thu, 14 May 2020 09:05:48 +0200 Subject: staging: greybus: uart: replace driver line-coding struct Drop the driver version of the line-coding request and use the protocol definition directly as was originally intended instead. This specifically avoids having the two versions of what is supposed to be the same struct ever getting out of sync. Note that this has in fact already happened once when the protocol definition had its implicit padding removed while the driver struct wasn't updated. The fact that we used the size of the then larger driver struct when memcpying its content to the stack didn't exactly make things better. A later addition of a flow-control field incidentally made the structures match again. Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20200514070548.4423-1-johan@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/uart.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'drivers/staging/greybus') diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c index 55c51143bb09..84de56800a21 100644 --- a/drivers/staging/greybus/uart.c +++ b/drivers/staging/greybus/uart.c @@ -40,14 +40,6 @@ #define GB_UART_FIRMWARE_CREDITS 4096 #define GB_UART_CREDIT_WAIT_TIMEOUT_MSEC 10000 -struct gb_tty_line_coding { - __le32 rate; - __u8 format; - __u8 parity; - __u8 data_bits; - __u8 flow_control; -}; - struct gb_tty { struct gbphy_device *gbphy_dev; struct tty_port port; @@ -66,7 +58,7 @@ struct gb_tty { struct mutex mutex; u8 ctrlin; /* input control lines */ u8 ctrlout; /* output control lines */ - struct gb_tty_line_coding line_coding; + struct gb_uart_set_line_coding_request line_coding; struct work_struct tx_work; struct kfifo write_fifo; bool close_pending; @@ -288,12 +280,9 @@ static void gb_uart_tx_write_work(struct work_struct *work) static int send_line_coding(struct gb_tty *tty) { - struct gb_uart_set_line_coding_request request; - - memcpy(&request, &tty->line_coding, - sizeof(tty->line_coding)); return gb_operation_sync(tty->connection, GB_UART_TYPE_SET_LINE_CODING, - &request, sizeof(request), NULL, 0); + &tty->line_coding, sizeof(tty->line_coding), + NULL, 0); } static int send_control(struct gb_tty *gb_tty, u8 control) @@ -493,9 +482,9 @@ static int gb_tty_break_ctl(struct tty_struct *tty, int state) static void gb_tty_set_termios(struct tty_struct *tty, struct ktermios *termios_old) { + struct gb_uart_set_line_coding_request newline; struct gb_tty *gb_tty = tty->driver_data; struct ktermios *termios = &tty->termios; - struct gb_tty_line_coding newline; u8 newctrl = gb_tty->ctrlout; newline.rate = cpu_to_le32(tty_get_baud_rate(tty)); -- cgit v1.2.3-59-g8ed1b From 3b75d8bd3be49ffb4878f2370dc565a36e11fe07 Mon Sep 17 00:00:00 2001 From: Till Varoquaux Date: Mon, 25 May 2020 02:10:43 -0400 Subject: staging: greybus: loopback: fix a spelling error. Successed -> succeeded. Signed-off-by: Till Varoquaux Reviewed-by: Alex Elder Link: https://lore.kernel.org/r/20200518051314.1785567-1-till.varoquaux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/loopback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging/greybus') diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c index 583d9708a191..2471448ba42a 100644 --- a/drivers/staging/greybus/loopback.c +++ b/drivers/staging/greybus/loopback.c @@ -135,7 +135,7 @@ static ssize_t name##_##field##_show(struct device *dev, \ char *buf) \ { \ struct gb_loopback *gb = dev_get_drvdata(dev); \ - /* Report 0 for min and max if no transfer successed */ \ + /* Report 0 for min and max if no transfer succeeded */ \ if (!gb->requests_completed) \ return sprintf(buf, "0\n"); \ return sprintf(buf, "%" #type "\n", gb->name.field); \ -- cgit v1.2.3-59-g8ed1b