All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/mlx4_core: fix handling return value of mlx4_slave_convert_port
@ 2015-12-14 10:05 Andrzej Hajda
  2015-12-14 10:05 ` [PATCH] doc: mei: fix handling return value of mei_recv_msg Andrzej Hajda
                   ` (6 more replies)
  0 siblings, 7 replies; 26+ messages in thread
From: Andrzej Hajda @ 2015-12-14 10:05 UTC (permalink / raw)
  To: Or Gerlitz, Jack Morgenstein
  Cc: Andrzej Hajda, Bartlomiej Zolnierkiewicz, Marek Szyprowski,
	David S. Miller, Eran Ben Elisha, Hadar Hen Zion, Moni Shoua,
	Yishai Hadas, Maor Gottlieb, netdev, linux-kernel

The function can return negative values, so its result should
be assigned to signed variable.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index da7f578..b46dbe2 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -4331,9 +4331,10 @@ int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
 		return -EOPNOTSUPP;
 
 	ctrl = (struct mlx4_net_trans_rule_hw_ctrl *)inbox->buf;
-	ctrl->port = mlx4_slave_convert_port(dev, slave, ctrl->port);
-	if (ctrl->port <= 0)
+	err = mlx4_slave_convert_port(dev, slave, ctrl->port);
+	if (err <= 0)
 		return -EINVAL;
+	ctrl->port = err;
 	qpn = be32_to_cpu(ctrl->qpn) & 0xffffff;
 	err = get_res(dev, slave, qpn, RES_QP, &rqp);
 	if (err) {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH] doc: mei: fix handling return value of mei_recv_msg
  2015-12-14 10:05 [PATCH] net/mlx4_core: fix handling return value of mlx4_slave_convert_port Andrzej Hajda
@ 2015-12-14 10:05 ` Andrzej Hajda
  2015-12-14 12:04   ` Winkler, Tomas
  2015-12-14 10:06   ` Andrzej Hajda
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 26+ messages in thread
From: Andrzej Hajda @ 2015-12-14 10:05 UTC (permalink / raw)
  To: Tomas Winkler
  Cc: Andrzej Hajda, Bartlomiej Zolnierkiewicz, Marek Szyprowski,
	Jonathan Corbet, linux-kernel, linux-doc

The function can return negative values, so its result should
be assigned to signed variable.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 Documentation/misc-devices/mei/mei-amt-version.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/misc-devices/mei/mei-amt-version.c b/Documentation/misc-devices/mei/mei-amt-version.c
index 57d0d87..33e67bd 100644
--- a/Documentation/misc-devices/mei/mei-amt-version.c
+++ b/Documentation/misc-devices/mei/mei-amt-version.c
@@ -370,7 +370,7 @@ static uint32_t amt_host_if_call(struct amt_host_if *acmd,
 			unsigned int expected_sz)
 {
 	uint32_t in_buf_sz;
-	uint32_t out_buf_sz;
+	ssize_t out_buf_sz;
 	ssize_t written;
 	uint32_t status;
 	struct amt_host_if_resp_header *msg_hdr;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH] clk: sunxi: fix handling return value of of_property_match_string
  2015-12-14 10:05 [PATCH] net/mlx4_core: fix handling return value of mlx4_slave_convert_port Andrzej Hajda
@ 2015-12-14 10:06   ` Andrzej Hajda
  2015-12-14 10:06   ` Andrzej Hajda
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 26+ messages in thread
From: Andrzej Hajda @ 2015-12-14 10:06 UTC (permalink / raw)
  To: Emilio López
  Cc: Andrzej Hajda, Bartlomiej Zolnierkiewicz, Marek Szyprowski,
	Michael Turquette, Stephen Boyd, Maxime Ripard, Chen-Yu Tsai,
	linux-clk, linux-arm-kernel, linux-kernel

The function can return negative values, so its result should
be assigned to signed variable.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/clk/sunxi/clk-sun8i-bus-gates.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/sunxi/clk-sun8i-bus-gates.c b/drivers/clk/sunxi/clk-sun8i-bus-gates.c
index 7ab60c5..ecadd97 100644
--- a/drivers/clk/sunxi/clk-sun8i-bus-gates.c
+++ b/drivers/clk/sunxi/clk-sun8i-bus-gates.c
@@ -47,12 +47,12 @@ static void __init sun8i_h3_bus_gates_init(struct device_node *node)
 		return;
 
 	for (i = 0; i < ARRAY_SIZE(names); i++) {
-		index = of_property_match_string(node, "clock-names",
-						 names[i]);
-		if (index < 0)
+		int idx = of_property_match_string(node, "clock-names",
+						   names[i]);
+		if (idx < 0)
 			return;
 
-		parents[i] = of_clk_get_parent_name(node, index);
+		parents[i] = of_clk_get_parent_name(node, idx);
 	}
 
 	clk_data = kmalloc(sizeof(struct clk_onecell_data), GFP_KERNEL);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH] clk: sunxi: fix handling return value of of_property_match_string
@ 2015-12-14 10:06   ` Andrzej Hajda
  0 siblings, 0 replies; 26+ messages in thread
From: Andrzej Hajda @ 2015-12-14 10:06 UTC (permalink / raw)
  To: linux-arm-kernel

The function can return negative values, so its result should
be assigned to signed variable.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/clk/sunxi/clk-sun8i-bus-gates.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/sunxi/clk-sun8i-bus-gates.c b/drivers/clk/sunxi/clk-sun8i-bus-gates.c
index 7ab60c5..ecadd97 100644
--- a/drivers/clk/sunxi/clk-sun8i-bus-gates.c
+++ b/drivers/clk/sunxi/clk-sun8i-bus-gates.c
@@ -47,12 +47,12 @@ static void __init sun8i_h3_bus_gates_init(struct device_node *node)
 		return;
 
 	for (i = 0; i < ARRAY_SIZE(names); i++) {
-		index = of_property_match_string(node, "clock-names",
-						 names[i]);
-		if (index < 0)
+		int idx = of_property_match_string(node, "clock-names",
+						   names[i]);
+		if (idx < 0)
 			return;
 
-		parents[i] = of_clk_get_parent_name(node, index);
+		parents[i] = of_clk_get_parent_name(node, idx);
 	}
 
 	clk_data = kmalloc(sizeof(struct clk_onecell_data), GFP_KERNEL);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH] ath9k_htc: fix handling return value of ath9k_hw_calibrate
  2015-12-14 10:05 [PATCH] net/mlx4_core: fix handling return value of mlx4_slave_convert_port Andrzej Hajda
  2015-12-14 10:05 ` [PATCH] doc: mei: fix handling return value of mei_recv_msg Andrzej Hajda
@ 2015-12-14 10:06   ` Andrzej Hajda
  2015-12-14 10:06   ` Andrzej Hajda
                     ` (4 subsequent siblings)
  6 siblings, 0 replies; 26+ messages in thread
From: Andrzej Hajda @ 2015-12-14 10:06 UTC (permalink / raw)
  To: QCA ath9k Development
  Cc: Andrzej Hajda, Bartlomiej Zolnierkiewicz, Marek Szyprowski,
	Kalle Valo, linux-wireless, ath9k-devel, netdev, linux-kernel

The function can return negative values in case of error.
Its result should be then tested for such case.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/net/wireless/ath/ath9k/htc_drv_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index a680a97..fe1fd1a 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -834,7 +834,7 @@ void ath9k_htc_ani_work(struct work_struct *work)
 		if (longcal || shortcal)
 			common->ani.caldone =
 				ath9k_hw_calibrate(ah, ah->curchan,
-						   ah->rxchainmask, longcal);
+						ah->rxchainmask, longcal) > 0;
 
 		ath9k_htc_ps_restore(priv);
 	}
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH] ath9k_htc: fix handling return value of ath9k_hw_calibrate
@ 2015-12-14 10:06   ` Andrzej Hajda
  0 siblings, 0 replies; 26+ messages in thread
From: Andrzej Hajda @ 2015-12-14 10:06 UTC (permalink / raw)
  To: QCA ath9k Development
  Cc: Andrzej Hajda, Bartlomiej Zolnierkiewicz, Marek Szyprowski,
	Kalle Valo, linux-wireless, ath9k-devel, netdev, linux-kernel

The function can return negative values in case of error.
Its result should be then tested for such case.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/net/wireless/ath/ath9k/htc_drv_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index a680a97..fe1fd1a 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -834,7 +834,7 @@ void ath9k_htc_ani_work(struct work_struct *work)
 		if (longcal || shortcal)
 			common->ani.caldone =
 				ath9k_hw_calibrate(ah, ah->curchan,
-						   ah->rxchainmask, longcal);
+						ah->rxchainmask, longcal) > 0;
 
 		ath9k_htc_ps_restore(priv);
 	}
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [ath9k-devel] [PATCH] ath9k_htc: fix handling return value of ath9k_hw_calibrate
@ 2015-12-14 10:06   ` Andrzej Hajda
  0 siblings, 0 replies; 26+ messages in thread
From: Andrzej Hajda @ 2015-12-14 10:06 UTC (permalink / raw)
  To: ath9k-devel

The function can return negative values in case of error.
Its result should be then tested for such case.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/net/wireless/ath/ath9k/htc_drv_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index a680a97..fe1fd1a 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -834,7 +834,7 @@ void ath9k_htc_ani_work(struct work_struct *work)
 		if (longcal || shortcal)
 			common->ani.caldone =
 				ath9k_hw_calibrate(ah, ah->curchan,
-						   ah->rxchainmask, longcal);
+						ah->rxchainmask, longcal) > 0;
 
 		ath9k_htc_ps_restore(priv);
 	}
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH] extcon: max14577: fix handling return value of regmap_irq_get_virq
  2015-12-14 10:05 [PATCH] net/mlx4_core: fix handling return value of mlx4_slave_convert_port Andrzej Hajda
                   ` (2 preceding siblings ...)
  2015-12-14 10:06   ` Andrzej Hajda
@ 2015-12-14 10:06 ` Andrzej Hajda
  2015-12-14 10:31   ` Krzysztof Kozlowski
  2015-12-15  1:08   ` [PATCH] extcon: max14577: " Chanwoo Choi
  2015-12-14 10:06 ` [PATCH] extcon: max77843: " Andrzej Hajda
                   ` (2 subsequent siblings)
  6 siblings, 2 replies; 26+ messages in thread
From: Andrzej Hajda @ 2015-12-14 10:06 UTC (permalink / raw)
  To: Chanwoo Choi, Krzysztof Kozlowski
  Cc: Andrzej Hajda, Bartlomiej Zolnierkiewicz, Marek Szyprowski,
	MyungJoo Ham, linux-kernel

The function can return negative values, so its result should
be assigned to signed variable.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/extcon/extcon-max14577.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c
index 601dbd9..b30ab97 100644
--- a/drivers/extcon/extcon-max14577.c
+++ b/drivers/extcon/extcon-max14577.c
@@ -692,7 +692,7 @@ static int max14577_muic_probe(struct platform_device *pdev)
 	/* Support irq domain for max14577 MUIC device */
 	for (i = 0; i < info->muic_irqs_num; i++) {
 		struct max14577_muic_irq *muic_irq = &info->muic_irqs[i];
-		unsigned int virq = 0;
+		int virq = 0;
 
 		virq = regmap_irq_get_virq(max14577->irq_data, muic_irq->irq);
 		if (virq <= 0)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH] extcon: max77843: fix handling return value of regmap_irq_get_virq
  2015-12-14 10:05 [PATCH] net/mlx4_core: fix handling return value of mlx4_slave_convert_port Andrzej Hajda
                   ` (3 preceding siblings ...)
  2015-12-14 10:06 ` [PATCH] extcon: max14577: fix handling return value of regmap_irq_get_virq Andrzej Hajda
@ 2015-12-14 10:06 ` Andrzej Hajda
  2015-12-14 10:30   ` Krzysztof Kozlowski
  2015-12-15  1:08   ` Chanwoo Choi
  2015-12-14 10:06 ` [PATCH] be2iscsi: fix handling return value of mgmt_open_connection Andrzej Hajda
  2015-12-15  9:09 ` [PATCH] net/mlx4_core: fix handling return value of mlx4_slave_convert_port Or Gerlitz
  6 siblings, 2 replies; 26+ messages in thread
From: Andrzej Hajda @ 2015-12-14 10:06 UTC (permalink / raw)
  To: MyungJoo Ham, Chanwoo Choi
  Cc: Andrzej Hajda, Bartlomiej Zolnierkiewicz, Marek Szyprowski, linux-kernel

The function can return negative values, so its result should
be assigned to signed variable.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/extcon/extcon-max77843.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon-max77843.c b/drivers/extcon/extcon-max77843.c
index 9f9ea33..74dfb7f 100644
--- a/drivers/extcon/extcon-max77843.c
+++ b/drivers/extcon/extcon-max77843.c
@@ -811,7 +811,7 @@ static int max77843_muic_probe(struct platform_device *pdev)
 
 	for (i = 0; i < ARRAY_SIZE(max77843_muic_irqs); i++) {
 		struct max77843_muic_irq *muic_irq = &max77843_muic_irqs[i];
-		unsigned int virq = 0;
+		int virq = 0;
 
 		virq = regmap_irq_get_virq(max77843->irq_data_muic,
 				muic_irq->irq);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH] be2iscsi: fix handling return value of mgmt_open_connection
  2015-12-14 10:05 [PATCH] net/mlx4_core: fix handling return value of mlx4_slave_convert_port Andrzej Hajda
                   ` (4 preceding siblings ...)
  2015-12-14 10:06 ` [PATCH] extcon: max77843: " Andrzej Hajda
@ 2015-12-14 10:06 ` Andrzej Hajda
  2015-12-15  9:09 ` [PATCH] net/mlx4_core: fix handling return value of mlx4_slave_convert_port Or Gerlitz
  6 siblings, 0 replies; 26+ messages in thread
From: Andrzej Hajda @ 2015-12-14 10:06 UTC (permalink / raw)
  To: Jayamohan Kallickal, Ketan Mukadam, John Soni Jose
  Cc: Andrzej Hajda, Bartlomiej Zolnierkiewicz, Marek Szyprowski,
	James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	linux-kernel

The function can return negative values, so its result should
be assigned to signed variable.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/scsi/be2iscsi/be_iscsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index b7087ba..ce9f192 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -1106,8 +1106,8 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
 	struct beiscsi_hba *phba = beiscsi_ep->phba;
 	struct tcp_connect_and_offload_out *ptcpcnct_out;
 	struct be_dma_mem nonemb_cmd;
-	unsigned int tag, req_memsize;
-	int ret = -ENOMEM;
+	unsigned int req_memsize;
+	int tag, ret = -ENOMEM;
 
 	beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
 		    "BS_%d : In beiscsi_open_conn\n");
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH] extcon: max77843: fix handling return value of regmap_irq_get_virq
  2015-12-14 10:06 ` [PATCH] extcon: max77843: " Andrzej Hajda
@ 2015-12-14 10:30   ` Krzysztof Kozlowski
  2015-12-15  1:08   ` Chanwoo Choi
  1 sibling, 0 replies; 26+ messages in thread
From: Krzysztof Kozlowski @ 2015-12-14 10:30 UTC (permalink / raw)
  To: Andrzej Hajda
  Cc: MyungJoo Ham, Chanwoo Choi, Bartlomiej Zolnierkiewicz,
	Marek Szyprowski, linux-kernel

2015-12-14 19:06 GMT+09:00 Andrzej Hajda <a.hajda@samsung.com>:
> The function can return negative values, so its result should
> be assigned to signed variable.
>
> The problem has been detected using proposed semantic patch
> scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
>
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
>
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> ---
>  drivers/extcon/extcon-max77843.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] extcon: max14577: fix handling return value of regmap_irq_get_virq
  2015-12-14 10:06 ` [PATCH] extcon: max14577: fix handling return value of regmap_irq_get_virq Andrzej Hajda
@ 2015-12-14 10:31   ` Krzysztof Kozlowski
  2015-12-14 11:12     ` [PATCH] extcon: max77693: " Andrzej Hajda
  2015-12-15  1:08   ` [PATCH] extcon: max14577: " Chanwoo Choi
  1 sibling, 1 reply; 26+ messages in thread
From: Krzysztof Kozlowski @ 2015-12-14 10:31 UTC (permalink / raw)
  To: Andrzej Hajda
  Cc: Chanwoo Choi, Bartlomiej Zolnierkiewicz, Marek Szyprowski,
	MyungJoo Ham, linux-kernel

2015-12-14 19:06 GMT+09:00 Andrzej Hajda <a.hajda@samsung.com>:
> The function can return negative values, so its result should
> be assigned to signed variable.
>
> The problem has been detected using proposed semantic patch
> scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
>
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
>
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> ---
>  drivers/extcon/extcon-max14577.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Do you plan to fix also max77693?

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH] extcon: max77693: fix handling return value of regmap_irq_get_virq
  2015-12-14 10:31   ` Krzysztof Kozlowski
@ 2015-12-14 11:12     ` Andrzej Hajda
  2015-12-15  0:22       ` Krzysztof Kozlowski
  2015-12-15  1:08       ` Chanwoo Choi
  0 siblings, 2 replies; 26+ messages in thread
From: Andrzej Hajda @ 2015-12-14 11:12 UTC (permalink / raw)
  To: Chanwoo Choi, Krzysztof Kozlowski
  Cc: Andrzej Hajda, Bartlomiej Zolnierkiewicz, Marek Szyprowski,
	MyungJoo Ham, linux-kernel

The function can return negative values, so its result should
be assigned to signed variable.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Suggested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
 drivers/extcon/extcon-max77693.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index 44c499e..fdf8f5d 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -1127,11 +1127,11 @@ static int max77693_muic_probe(struct platform_device *pdev)
 	/* Support irq domain for MAX77693 MUIC device */
 	for (i = 0; i < ARRAY_SIZE(muic_irqs); i++) {
 		struct max77693_muic_irq *muic_irq = &muic_irqs[i];
-		unsigned int virq = 0;
+		int virq;
 
 		virq = regmap_irq_get_virq(max77693->irq_data_muic,
 					muic_irq->irq);
-		if (!virq)
+		if (virq <= 0)
 			return -EINVAL;
 		muic_irq->virq = virq;
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* RE: [PATCH] doc: mei: fix handling return value of mei_recv_msg
  2015-12-14 10:05 ` [PATCH] doc: mei: fix handling return value of mei_recv_msg Andrzej Hajda
@ 2015-12-14 12:04   ` Winkler, Tomas
  0 siblings, 0 replies; 26+ messages in thread
From: Winkler, Tomas @ 2015-12-14 12:04 UTC (permalink / raw)
  To: Andrzej Hajda
  Cc: Bartlomiej Zolnierkiewicz, Marek Szyprowski, Jonathan Corbet,
	linux-kernel, linux-doc, Greg KH (gregkh@linuxfoundation.org)

> The function can return negative values, so its result should
> be assigned to signed variable.
> 
> The problem has been detected using proposed semantic patch
> scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
> 
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
> 
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> ---
>  Documentation/misc-devices/mei/mei-amt-version.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Documentation/misc-devices/mei/mei-amt-version.c
> b/Documentation/misc-devices/mei/mei-amt-version.c
> index 57d0d87..33e67bd 100644
> --- a/Documentation/misc-devices/mei/mei-amt-version.c
> +++ b/Documentation/misc-devices/mei/mei-amt-version.c
> @@ -370,7 +370,7 @@ static uint32_t amt_host_if_call(struct amt_host_if
> *acmd,
>  			unsigned int expected_sz)
>  {
>  	uint32_t in_buf_sz;
If are you at that then it will be desired to change the type to ssize_t also for in_buf_sz as mei_recv_msg takes ssize_t argument. 
> -	uint32_t out_buf_sz;
> +	ssize_t out_buf_sz;
>  	ssize_t written;
>  	uint32_t status;
>  	struct amt_host_if_resp_header *msg_hdr;

Thanks
Tomas


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] clk: sunxi: fix handling return value of of_property_match_string
  2015-12-14 10:06   ` Andrzej Hajda
@ 2015-12-14 13:05     ` Maxime Ripard
  -1 siblings, 0 replies; 26+ messages in thread
From: Maxime Ripard @ 2015-12-14 13:05 UTC (permalink / raw)
  To: Andrzej Hajda
  Cc: Emilio López, Bartlomiej Zolnierkiewicz, Marek Szyprowski,
	Michael Turquette, Stephen Boyd, Chen-Yu Tsai, linux-clk,
	linux-arm-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 568 bytes --]

Hi,

On Mon, Dec 14, 2015 at 11:06:00AM +0100, Andrzej Hajda wrote:
> The function can return negative values, so its result should
> be assigned to signed variable.
> 
> The problem has been detected using proposed semantic patch
> scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
> 
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
> 
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>

Applied, thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH] clk: sunxi: fix handling return value of of_property_match_string
@ 2015-12-14 13:05     ` Maxime Ripard
  0 siblings, 0 replies; 26+ messages in thread
From: Maxime Ripard @ 2015-12-14 13:05 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Mon, Dec 14, 2015 at 11:06:00AM +0100, Andrzej Hajda wrote:
> The function can return negative values, so its result should
> be assigned to signed variable.
> 
> The problem has been detected using proposed semantic patch
> scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
> 
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
> 
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>

Applied, thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151214/439a066f/attachment.sig>

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] extcon: max77693: fix handling return value of regmap_irq_get_virq
  2015-12-14 11:12     ` [PATCH] extcon: max77693: " Andrzej Hajda
@ 2015-12-15  0:22       ` Krzysztof Kozlowski
  2015-12-15  1:08       ` Chanwoo Choi
  1 sibling, 0 replies; 26+ messages in thread
From: Krzysztof Kozlowski @ 2015-12-15  0:22 UTC (permalink / raw)
  To: Andrzej Hajda, Chanwoo Choi
  Cc: Bartlomiej Zolnierkiewicz, Marek Szyprowski, MyungJoo Ham, linux-kernel

On 14.12.2015 20:12, Andrzej Hajda wrote:
> The function can return negative values, so its result should
> be assigned to signed variable.
> 
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> Suggested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> ---
>  drivers/extcon/extcon-max77693.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] extcon: max14577: fix handling return value of regmap_irq_get_virq
  2015-12-14 10:06 ` [PATCH] extcon: max14577: fix handling return value of regmap_irq_get_virq Andrzej Hajda
  2015-12-14 10:31   ` Krzysztof Kozlowski
@ 2015-12-15  1:08   ` Chanwoo Choi
  1 sibling, 0 replies; 26+ messages in thread
From: Chanwoo Choi @ 2015-12-15  1:08 UTC (permalink / raw)
  To: Andrzej Hajda, Krzysztof Kozlowski
  Cc: Bartlomiej Zolnierkiewicz, Marek Szyprowski, MyungJoo Ham, linux-kernel

On 2015년 12월 14일 19:06, Andrzej Hajda wrote:
> The function can return negative values, so its result should
> be assigned to signed variable.
> 
> The problem has been detected using proposed semantic patch
> scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
> 
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
> 
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> ---
>  drivers/extcon/extcon-max14577.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c
> index 601dbd9..b30ab97 100644
> --- a/drivers/extcon/extcon-max14577.c
> +++ b/drivers/extcon/extcon-max14577.c
> @@ -692,7 +692,7 @@ static int max14577_muic_probe(struct platform_device *pdev)
>  	/* Support irq domain for max14577 MUIC device */
>  	for (i = 0; i < info->muic_irqs_num; i++) {
>  		struct max14577_muic_irq *muic_irq = &info->muic_irqs[i];
> -		unsigned int virq = 0;
> +		int virq = 0;
>  
>  		virq = regmap_irq_get_virq(max14577->irq_data, muic_irq->irq);
>  		if (virq <= 0)
> 

Applied it.

Thanks,
Chanwoo Choi

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] extcon: max77693: fix handling return value of regmap_irq_get_virq
  2015-12-14 11:12     ` [PATCH] extcon: max77693: " Andrzej Hajda
  2015-12-15  0:22       ` Krzysztof Kozlowski
@ 2015-12-15  1:08       ` Chanwoo Choi
  1 sibling, 0 replies; 26+ messages in thread
From: Chanwoo Choi @ 2015-12-15  1:08 UTC (permalink / raw)
  To: Andrzej Hajda, Krzysztof Kozlowski
  Cc: Bartlomiej Zolnierkiewicz, Marek Szyprowski, MyungJoo Ham, linux-kernel

On 2015년 12월 14일 20:12, Andrzej Hajda wrote:
> The function can return negative values, so its result should
> be assigned to signed variable.
> 
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> Suggested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> ---
>  drivers/extcon/extcon-max77693.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
> index 44c499e..fdf8f5d 100644
> --- a/drivers/extcon/extcon-max77693.c
> +++ b/drivers/extcon/extcon-max77693.c
> @@ -1127,11 +1127,11 @@ static int max77693_muic_probe(struct platform_device *pdev)
>  	/* Support irq domain for MAX77693 MUIC device */
>  	for (i = 0; i < ARRAY_SIZE(muic_irqs); i++) {
>  		struct max77693_muic_irq *muic_irq = &muic_irqs[i];
> -		unsigned int virq = 0;
> +		int virq;
>  
>  		virq = regmap_irq_get_virq(max77693->irq_data_muic,
>  					muic_irq->irq);
> -		if (!virq)
> +		if (virq <= 0)
>  			return -EINVAL;
>  		muic_irq->virq = virq;
>  
> 

Applied it.

Thanks,
Chanwoo Choi

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] extcon: max77843: fix handling return value of regmap_irq_get_virq
  2015-12-14 10:06 ` [PATCH] extcon: max77843: " Andrzej Hajda
  2015-12-14 10:30   ` Krzysztof Kozlowski
@ 2015-12-15  1:08   ` Chanwoo Choi
  1 sibling, 0 replies; 26+ messages in thread
From: Chanwoo Choi @ 2015-12-15  1:08 UTC (permalink / raw)
  To: Andrzej Hajda, MyungJoo Ham
  Cc: Bartlomiej Zolnierkiewicz, Marek Szyprowski, linux-kernel

On 2015년 12월 14일 19:06, Andrzej Hajda wrote:
> The function can return negative values, so its result should
> be assigned to signed variable.
> 
> The problem has been detected using proposed semantic patch
> scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
> 
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
> 
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> ---
>  drivers/extcon/extcon-max77843.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/extcon/extcon-max77843.c b/drivers/extcon/extcon-max77843.c
> index 9f9ea33..74dfb7f 100644
> --- a/drivers/extcon/extcon-max77843.c
> +++ b/drivers/extcon/extcon-max77843.c
> @@ -811,7 +811,7 @@ static int max77843_muic_probe(struct platform_device *pdev)
>  
>  	for (i = 0; i < ARRAY_SIZE(max77843_muic_irqs); i++) {
>  		struct max77843_muic_irq *muic_irq = &max77843_muic_irqs[i];
> -		unsigned int virq = 0;
> +		int virq = 0;
>  
>  		virq = regmap_irq_get_virq(max77843->irq_data_muic,
>  				muic_irq->irq);
> 

Applied it.

Thanks,
Chanwoo Choi

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] net/mlx4_core: fix handling return value of mlx4_slave_convert_port
  2015-12-14 10:05 [PATCH] net/mlx4_core: fix handling return value of mlx4_slave_convert_port Andrzej Hajda
                   ` (5 preceding siblings ...)
  2015-12-14 10:06 ` [PATCH] be2iscsi: fix handling return value of mgmt_open_connection Andrzej Hajda
@ 2015-12-15  9:09 ` Or Gerlitz
  2015-12-15 16:55   ` David Miller
  6 siblings, 1 reply; 26+ messages in thread
From: Or Gerlitz @ 2015-12-15  9:09 UTC (permalink / raw)
  To: Andrzej Hajda
  Cc: Jack Morgenstein, Bartlomiej Zolnierkiewicz, Marek Szyprowski,
	David S. Miller, Eran Ben Elisha, Hadar Hen Zion, Moni Shoua,
	Yishai Hadas, Maor Gottlieb, netdev, linux-kernel

On 12/14/2015 12:05 PM, Andrzej Hajda wrote:
> The function can return negative values, so its result should
> be assigned to signed variable.
>
> The problem has been detected using proposed semantic patch
> scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
>
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
>

Please add here

Fixes: fc48866f7 ('net/mlx4: Adapt code for N-Port VF')


> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>

otherwise, Looks good

Acked-by: Or Gerlitz <ogerlitz@mellanox.com>

Or.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] net/mlx4_core: fix handling return value of mlx4_slave_convert_port
  2015-12-15  9:09 ` [PATCH] net/mlx4_core: fix handling return value of mlx4_slave_convert_port Or Gerlitz
@ 2015-12-15 16:55   ` David Miller
  0 siblings, 0 replies; 26+ messages in thread
From: David Miller @ 2015-12-15 16:55 UTC (permalink / raw)
  To: ogerlitz
  Cc: a.hajda, jackm, b.zolnierkie, m.szyprowski, eranbe, hadarh,
	monis, yishaih, maorg, netdev, linux-kernel

From: Or Gerlitz <ogerlitz@mellanox.com>
Date: Tue, 15 Dec 2015 11:09:40 +0200

> On 12/14/2015 12:05 PM, Andrzej Hajda wrote:
>> The function can return negative values, so its result should
>> be assigned to signed variable.
>>
>> The problem has been detected using proposed semantic patch
>> scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
>>
>> [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
>>
> 
> Please add here
> 
> Fixes: fc48866f7 ('net/mlx4: Adapt code for N-Port VF')
> 
>> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> 
> otherwise, Looks good
> 
> Acked-by: Or Gerlitz <ogerlitz@mellanox.com>

Applied with Fixes tag added.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] ath9k_htc: fix handling return value of ath9k_hw_calibrate
  2015-12-14 10:06   ` Andrzej Hajda
  (?)
  (?)
@ 2015-12-31 13:12     ` Kalle Valo
  -1 siblings, 0 replies; 26+ messages in thread
From: Kalle Valo @ 2015-12-31 13:12 UTC (permalink / raw)
  To: Andrzej Hajda
  Cc: QCA ath9k Development, Bartlomiej Zolnierkiewicz,
	Marek Szyprowski, linux-wireless, ath9k-devel, netdev,
	linux-kernel

Andrzej Hajda <a.hajda@samsung.com> writes:

> The function can return negative values in case of error.
> Its result should be then tested for such case.
>
> The problem has been detected using proposed semantic patch
> scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
>
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
>
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>

Applied to ath.git, thanks.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] ath9k_htc: fix handling return value of ath9k_hw_calibrate
@ 2015-12-31 13:12     ` Kalle Valo
  0 siblings, 0 replies; 26+ messages in thread
From: Kalle Valo @ 2015-12-31 13:12 UTC (permalink / raw)
  To: Andrzej Hajda
  Cc: QCA ath9k Development, Bartlomiej Zolnierkiewicz,
	Marek Szyprowski, linux-wireless, ath9k-devel, netdev,
	linux-kernel

Andrzej Hajda <a.hajda@samsung.com> writes:

> The function can return negative values in case of error.
> Its result should be then tested for such case.
>
> The problem has been detected using proposed semantic patch
> scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
>
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
>
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>

Applied to ath.git, thanks.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] ath9k_htc: fix handling return value of ath9k_hw_calibrate
@ 2015-12-31 13:12     ` Kalle Valo
  0 siblings, 0 replies; 26+ messages in thread
From: Kalle Valo @ 2015-12-31 13:12 UTC (permalink / raw)
  To: Andrzej Hajda
  Cc: QCA ath9k Development, Bartlomiej Zolnierkiewicz,
	Marek Szyprowski, linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	ath9k-devel-xDcbHBWguxHbcTqmT+pZeQ,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

Andrzej Hajda <a.hajda-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> writes:

> The function can return negative values in case of error.
> Its result should be then tested for such case.
>
> The problem has been detected using proposed semantic patch
> scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
>
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
>
> Signed-off-by: Andrzej Hajda <a.hajda-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>

Applied to ath.git, thanks.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [ath9k-devel] [PATCH] ath9k_htc: fix handling return value of ath9k_hw_calibrate
@ 2015-12-31 13:12     ` Kalle Valo
  0 siblings, 0 replies; 26+ messages in thread
From: Kalle Valo @ 2015-12-31 13:12 UTC (permalink / raw)
  To: ath9k-devel

Andrzej Hajda <a.hajda@samsung.com> writes:

> The function can return negative values in case of error.
> Its result should be then tested for such case.
>
> The problem has been detected using proposed semantic patch
> scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
>
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
>
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>

Applied to ath.git, thanks.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2015-12-31 13:12 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-14 10:05 [PATCH] net/mlx4_core: fix handling return value of mlx4_slave_convert_port Andrzej Hajda
2015-12-14 10:05 ` [PATCH] doc: mei: fix handling return value of mei_recv_msg Andrzej Hajda
2015-12-14 12:04   ` Winkler, Tomas
2015-12-14 10:06 ` [PATCH] clk: sunxi: fix handling return value of of_property_match_string Andrzej Hajda
2015-12-14 10:06   ` Andrzej Hajda
2015-12-14 13:05   ` Maxime Ripard
2015-12-14 13:05     ` Maxime Ripard
2015-12-14 10:06 ` [PATCH] ath9k_htc: fix handling return value of ath9k_hw_calibrate Andrzej Hajda
2015-12-14 10:06   ` [ath9k-devel] " Andrzej Hajda
2015-12-14 10:06   ` Andrzej Hajda
2015-12-31 13:12   ` Kalle Valo
2015-12-31 13:12     ` [ath9k-devel] " Kalle Valo
2015-12-31 13:12     ` Kalle Valo
2015-12-31 13:12     ` Kalle Valo
2015-12-14 10:06 ` [PATCH] extcon: max14577: fix handling return value of regmap_irq_get_virq Andrzej Hajda
2015-12-14 10:31   ` Krzysztof Kozlowski
2015-12-14 11:12     ` [PATCH] extcon: max77693: " Andrzej Hajda
2015-12-15  0:22       ` Krzysztof Kozlowski
2015-12-15  1:08       ` Chanwoo Choi
2015-12-15  1:08   ` [PATCH] extcon: max14577: " Chanwoo Choi
2015-12-14 10:06 ` [PATCH] extcon: max77843: " Andrzej Hajda
2015-12-14 10:30   ` Krzysztof Kozlowski
2015-12-15  1:08   ` Chanwoo Choi
2015-12-14 10:06 ` [PATCH] be2iscsi: fix handling return value of mgmt_open_connection Andrzej Hajda
2015-12-15  9:09 ` [PATCH] net/mlx4_core: fix handling return value of mlx4_slave_convert_port Or Gerlitz
2015-12-15 16:55   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.