Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1204480 > unrolled thread
| Started by | Brian Norris <computersforpeace@gmail.com> |
|---|---|
| First post | 2015-08-10 20:50 +0200 |
| Last post | 2015-08-13 02:50 +0200 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] extcon: fix signedness issues Brian Norris <computersforpeace@gmail.com> - 2015-08-10 20:50 +0200
Re: [PATCH] extcon: fix signedness issues Chanwoo Choi <cw00.choi@samsung.com> - 2015-08-11 09:00 +0200
Re: [PATCH] extcon: fix signedness issues Brian Norris <computersforpeace@gmail.com> - 2015-08-13 01:00 +0200
Re: [PATCH] extcon: fix signedness issues Chanwoo Choi <cw00.choi@samsung.com> - 2015-08-13 02:50 +0200
| From | Brian Norris <computersforpeace@gmail.com> |
|---|---|
| Date | 2015-08-10 20:50 +0200 |
| Subject | [PATCH] extcon: fix signedness issues |
| Message-ID | <pW0j0-6f6-13@gated-at.bofh.it> |
commit be052cc87745 ("extcon: Fix hang and
extcon_get/set_cable_state().") introduced several signedness issues.
sparse reports them:
drivers/extcon/extcon.c: In function ‘find_cable_index_by_name’:
drivers/extcon/extcon.c:153:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
drivers/extcon/extcon.c: In function ‘extcon_get_cable_state’:
drivers/extcon/extcon.c:384:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
drivers/extcon/extcon.c: In function ‘extcon_set_cable_state’:
drivers/extcon/extcon.c:432:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
Fixes: be052cc87745 ("extcon: Fix hang and extcon_get/set_cable_state().")
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
This is *only* compile-tested
drivers/extcon/extcon.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 43b57b02d050..a394ca419715 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -126,7 +126,7 @@ static int find_cable_index_by_id(struct extcon_dev *edev, const unsigned int id
static int find_cable_id_by_name(struct extcon_dev *edev, const char *name)
{
- unsigned int id = -EINVAL;
+ int id = -EINVAL;
int i = 0;
/* Find the id of extcon cable */
@@ -143,7 +143,7 @@ static int find_cable_id_by_name(struct extcon_dev *edev, const char *name)
static int find_cable_index_by_name(struct extcon_dev *edev, const char *name)
{
- unsigned int id;
+ int id;
if (edev->max_supported == 0)
return -EINVAL;
@@ -378,7 +378,7 @@ EXPORT_SYMBOL_GPL(extcon_get_cable_state_);
*/
int extcon_get_cable_state(struct extcon_dev *edev, const char *cable_name)
{
- unsigned int id;
+ int id;
id = find_cable_id_by_name(edev, cable_name);
if (id < 0)
@@ -426,7 +426,7 @@ EXPORT_SYMBOL_GPL(extcon_set_cable_state_);
int extcon_set_cable_state(struct extcon_dev *edev,
const char *cable_name, bool cable_state)
{
- unsigned int id;
+ int id;
id = find_cable_id_by_name(edev, cable_name);
if (id < 0)
--
2.5.0.rc2.392.g76e840b
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| Date | 2015-08-11 09:00 +0200 |
| Message-ID | <pWbHs-5QC-23@gated-at.bofh.it> |
| In reply to | #1204480 |
Hi Brian,
I knew this issue. So patch[1] fixed it already.
I sent the extcon pull request[2] including patch[1] for Linux 4.3.
[1] http://git.kernel.org/cgit/linux/kernel/git/chanwoo/extcon.git/commit/?h=extcon-next&id=a598af7f0279195abffbfb9bf2070457e9c89ff3
[2] https://lkml.org/lkml/2015/8/11/5
Thanks,
Chanwoo Choi
On 08/11/2015 03:39 AM, Brian Norris wrote:
> commit be052cc87745 ("extcon: Fix hang and
> extcon_get/set_cable_state().") introduced several signedness issues.
> sparse reports them:
>
> drivers/extcon/extcon.c: In function ‘find_cable_index_by_name’:
> drivers/extcon/extcon.c:153:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
> drivers/extcon/extcon.c: In function ‘extcon_get_cable_state’:
> drivers/extcon/extcon.c:384:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
> drivers/extcon/extcon.c: In function ‘extcon_set_cable_state’:
> drivers/extcon/extcon.c:432:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
>
> Fixes: be052cc87745 ("extcon: Fix hang and extcon_get/set_cable_state().")
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
> ---
> This is *only* compile-tested
>
> drivers/extcon/extcon.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
> index 43b57b02d050..a394ca419715 100644
> --- a/drivers/extcon/extcon.c
> +++ b/drivers/extcon/extcon.c
> @@ -126,7 +126,7 @@ static int find_cable_index_by_id(struct extcon_dev *edev, const unsigned int id
>
> static int find_cable_id_by_name(struct extcon_dev *edev, const char *name)
> {
> - unsigned int id = -EINVAL;
> + int id = -EINVAL;
> int i = 0;
>
> /* Find the id of extcon cable */
> @@ -143,7 +143,7 @@ static int find_cable_id_by_name(struct extcon_dev *edev, const char *name)
>
> static int find_cable_index_by_name(struct extcon_dev *edev, const char *name)
> {
> - unsigned int id;
> + int id;
>
> if (edev->max_supported == 0)
> return -EINVAL;
> @@ -378,7 +378,7 @@ EXPORT_SYMBOL_GPL(extcon_get_cable_state_);
> */
> int extcon_get_cable_state(struct extcon_dev *edev, const char *cable_name)
> {
> - unsigned int id;
> + int id;
>
> id = find_cable_id_by_name(edev, cable_name);
> if (id < 0)
> @@ -426,7 +426,7 @@ EXPORT_SYMBOL_GPL(extcon_set_cable_state_);
> int extcon_set_cable_state(struct extcon_dev *edev,
> const char *cable_name, bool cable_state)
> {
> - unsigned int id;
> + int id;
>
> id = find_cable_id_by_name(edev, cable_name);
> if (id < 0)
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Brian Norris <computersforpeace@gmail.com> |
|---|---|
| Date | 2015-08-13 01:00 +0200 |
| Message-ID | <pWNa1-1ti-9@gated-at.bofh.it> |
| In reply to | #1204830 |
On Tue, Aug 11, 2015 at 03:56:44PM +0900, Chanwoo Choi wrote: > I knew this issue. So patch[1] fixed it already. Awesome. FWIW, my Google-fu fails to find this patch on any mail archive; just your pull request. > I sent the extcon pull request[2] including patch[1] for Linux 4.3. > > [1] http://git.kernel.org/cgit/linux/kernel/git/chanwoo/extcon.git/commit/?h=extcon-next&id=a598af7f0279195abffbfb9bf2070457e9c89ff3 > [2] https://lkml.org/lkml/2015/8/11/5 Regards, Brian -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| Date | 2015-08-13 02:50 +0200 |
| Message-ID | <pWOSt-43r-1@gated-at.bofh.it> |
| In reply to | #1206403 |
Hi Brian, On 08/13/2015 07:57 AM, Brian Norris wrote: > On Tue, Aug 11, 2015 at 03:56:44PM +0900, Chanwoo Choi wrote: >> I knew this issue. So patch[1] fixed it already. > > Awesome. > > FWIW, my Google-fu fails to find this patch on any mail archive; just > your pull request. You can check it on patch[3]. As I add commit message of patch[1], I modified the patch title. [3] https://lkml.org/lkml/2015/8/4/89 Thanks, Chanwoo Choi > >> I sent the extcon pull request[2] including patch[1] for Linux 4.3. >> >> [1] http://git.kernel.org/cgit/linux/kernel/git/chanwoo/extcon.git/commit/?h=extcon-next&id=a598af7f0279195abffbfb9bf2070457e9c89ff3 >> [2] https://lkml.org/lkml/2015/8/11/5 > > Regards, > Brian > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web