* [staging:staging-testing 41/59] drivers/staging/wfx/main.c:47:14-21: ERROR: PTR_ERR applied after initialization to constant on line 42
@ 2019-10-04 10:48 kbuild test robot
2019-10-07 8:36 ` Jerome Pouiller
0 siblings, 1 reply; 6+ messages in thread
From: kbuild test robot @ 2019-10-04 10:48 UTC (permalink / raw)
To: Jérôme Pouiller; +Cc: devel, Greg Kroah-Hartman, kbuild-all
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-testing
head: 40115bbc40e2fd2de0e01ef2a28e0d09a1b5d0d1
commit: 0096214a59a72b3c3c943e27bd03307324d3ce0f [41/59] staging: wfx: add support for I/O access
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
coccinelle warnings: (new ones prefixed by >>)
>> drivers/staging/wfx/main.c:47:14-21: ERROR: PTR_ERR applied after initialization to constant on line 42
vim +47 drivers/staging/wfx/main.c
30
31 struct gpio_desc *wfx_get_gpio(struct device *dev, int override, const char *label)
32 {
33 struct gpio_desc *ret;
34 char label_buf[256];
35
36 if (override >= 0) {
37 snprintf(label_buf, sizeof(label_buf), "wfx_%s", label);
38 ret = ERR_PTR(devm_gpio_request_one(dev, override, GPIOF_OUT_INIT_LOW, label_buf));
39 if (!ret)
40 ret = gpio_to_desc(override);
41 } else if (override == -1) {
> 42 ret = NULL;
43 } else {
44 ret = devm_gpiod_get(dev, label, GPIOD_OUT_LOW);
45 }
46 if (IS_ERR(ret) || !ret) {
> 47 if (!ret || PTR_ERR(ret) == -ENOENT)
48 dev_warn(dev, "gpio %s is not defined\n", label);
49 else
50 dev_warn(dev, "error while requesting gpio %s\n", label);
51 ret = NULL;
52 } else {
53 dev_dbg(dev, "using gpio %d for %s\n", desc_to_gpio(ret), label);
54 }
55 return ret;
56 }
57
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [staging:staging-testing 41/59] drivers/staging/wfx/main.c:47:14-21: ERROR: PTR_ERR applied after initialization to constant on line 42
2019-10-04 10:48 [staging:staging-testing 41/59] drivers/staging/wfx/main.c:47:14-21: ERROR: PTR_ERR applied after initialization to constant on line 42 kbuild test robot
@ 2019-10-07 8:36 ` Jerome Pouiller
2019-10-07 8:57 ` Greg Kroah-Hartman
2019-10-09 6:50 ` Rong Chen
0 siblings, 2 replies; 6+ messages in thread
From: Jerome Pouiller @ 2019-10-07 8:36 UTC (permalink / raw)
To: kbuild test robot; +Cc: devel, Greg Kroah-Hartman, kbuild-all
On Friday 4 October 2019 12:48:32 CEST kbuild test robot wrote:
[...]
> >> drivers/staging/wfx/main.c:47:14-21: ERROR: PTR_ERR applied after initialization to constant on line 42
>
> vim +47 drivers/staging/wfx/main.c
>
> 30
> 31 struct gpio_desc *wfx_get_gpio(struct device *dev, int override, const char *label)
> 32 {
> 33 struct gpio_desc *ret;
> 34 char label_buf[256];
> 35
> 36 if (override >= 0) {
> 37 snprintf(label_buf, sizeof(label_buf), "wfx_%s", label);
> 38 ret = ERR_PTR(devm_gpio_request_one(dev, override, GPIOF_OUT_INIT_LOW, label_buf));
> 39 if (!ret)
> 40 ret = gpio_to_desc(override);
> 41 } else if (override == -1) {
> > 42 ret = NULL;
> 43 } else {
> 44 ret = devm_gpiod_get(dev, label, GPIOD_OUT_LOW);
> 45 }
> 46 if (IS_ERR(ret) || !ret) {
> > 47 if (!ret || PTR_ERR(ret) == -ENOENT)
> 48 dev_warn(dev, "gpio %s is not defined\n", label);
> 49 else
> 50 dev_warn(dev, "error while requesting gpio %s\n", label);
> 51 ret = NULL;
> 52 } else {
> 53 dev_dbg(dev, "using gpio %d for %s\n", desc_to_gpio(ret), label);
> 54 }
> 55 return ret;
> 56 }
> 57
I think that this report is a false positive or I missed something?
--
Jérôme Pouiller
--
Jérôme Pouiller
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [staging:staging-testing 41/59] drivers/staging/wfx/main.c:47:14-21: ERROR: PTR_ERR applied after initialization to constant on line 42
2019-10-07 8:36 ` Jerome Pouiller
@ 2019-10-07 8:57 ` Greg Kroah-Hartman
2019-10-09 6:50 ` Rong Chen
1 sibling, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2019-10-07 8:57 UTC (permalink / raw)
To: Jerome Pouiller; +Cc: devel, kbuild-all
On Mon, Oct 07, 2019 at 08:36:22AM +0000, Jerome Pouiller wrote:
> On Friday 4 October 2019 12:48:32 CEST kbuild test robot wrote:
> [...]
> > >> drivers/staging/wfx/main.c:47:14-21: ERROR: PTR_ERR applied after initialization to constant on line 42
> >
> > vim +47 drivers/staging/wfx/main.c
> >
> > 30
> > 31 struct gpio_desc *wfx_get_gpio(struct device *dev, int override, const char *label)
> > 32 {
> > 33 struct gpio_desc *ret;
> > 34 char label_buf[256];
> > 35
> > 36 if (override >= 0) {
> > 37 snprintf(label_buf, sizeof(label_buf), "wfx_%s", label);
> > 38 ret = ERR_PTR(devm_gpio_request_one(dev, override, GPIOF_OUT_INIT_LOW, label_buf));
> > 39 if (!ret)
> > 40 ret = gpio_to_desc(override);
> > 41 } else if (override == -1) {
> > > 42 ret = NULL;
> > 43 } else {
> > 44 ret = devm_gpiod_get(dev, label, GPIOD_OUT_LOW);
> > 45 }
> > 46 if (IS_ERR(ret) || !ret) {
> > > 47 if (!ret || PTR_ERR(ret) == -ENOENT)
> > 48 dev_warn(dev, "gpio %s is not defined\n", label);
> > 49 else
> > 50 dev_warn(dev, "error while requesting gpio %s\n", label);
> > 51 ret = NULL;
> > 52 } else {
> > 53 dev_dbg(dev, "using gpio %d for %s\n", desc_to_gpio(ret), label);
> > 54 }
> > 55 return ret;
> > 56 }
> > 57
>
> I think that this report is a false positive or I missed something?
No idea, but I really can not understand that code at all, so it does
need to be simplified no matter what :)
thanks,
greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [staging:staging-testing 41/59] drivers/staging/wfx/main.c:47:14-21: ERROR: PTR_ERR applied after initialization to constant on line 42
2019-10-07 8:36 ` Jerome Pouiller
2019-10-07 8:57 ` Greg Kroah-Hartman
@ 2019-10-09 6:50 ` Rong Chen
2019-10-09 14:21 ` Jerome Pouiller
1 sibling, 1 reply; 6+ messages in thread
From: Rong Chen @ 2019-10-09 6:50 UTC (permalink / raw)
To: Jerome Pouiller, kbuild test robot; +Cc: devel, Greg Kroah-Hartman, kbuild-all
On 10/7/19 4:36 PM, Jerome Pouiller wrote:
> On Friday 4 October 2019 12:48:32 CEST kbuild test robot wrote:
> [...]
>>>> drivers/staging/wfx/main.c:47:14-21: ERROR: PTR_ERR applied after initialization to constant on line 42
>> vim +47 drivers/staging/wfx/main.c
>>
>> 30
>> 31 struct gpio_desc *wfx_get_gpio(struct device *dev, int override, const char *label)
>> 32 {
>> 33 struct gpio_desc *ret;
>> 34 char label_buf[256];
>> 35
>> 36 if (override >= 0) {
>> 37 snprintf(label_buf, sizeof(label_buf), "wfx_%s", label);
>> 38 ret = ERR_PTR(devm_gpio_request_one(dev, override, GPIOF_OUT_INIT_LOW, label_buf));
>> 39 if (!ret)
>> 40 ret = gpio_to_desc(override);
>> 41 } else if (override == -1) {
>> > 42 ret = NULL;
>> 43 } else {
>> 44 ret = devm_gpiod_get(dev, label, GPIOD_OUT_LOW);
>> 45 }
>> 46 if (IS_ERR(ret) || !ret) {
>> > 47 if (!ret || PTR_ERR(ret) == -ENOENT)
>> 48 dev_warn(dev, "gpio %s is not defined\n", label);
>> 49 else
>> 50 dev_warn(dev, "error while requesting gpio %s\n", label);
>> 51 ret = NULL;
>> 52 } else {
>> 53 dev_dbg(dev, "using gpio %d for %s\n", desc_to_gpio(ret), label);
>> 54 }
>> 55 return ret;
>> 56 }
>> 57
> I think that this report is a false positive or I missed something?
>
Hi,
Sorry for the inconvenience, but we confirmed that the error first
appeared since commit 0096214a59.
Best Regards,
Rong Chen
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [staging:staging-testing 41/59] drivers/staging/wfx/main.c:47:14-21: ERROR: PTR_ERR applied after initialization to constant on line 42
2019-10-09 6:50 ` Rong Chen
@ 2019-10-09 14:21 ` Jerome Pouiller
2019-10-09 15:07 ` Dan Carpenter
0 siblings, 1 reply; 6+ messages in thread
From: Jerome Pouiller @ 2019-10-09 14:21 UTC (permalink / raw)
To: Rong Chen; +Cc: devel, Greg Kroah-Hartman, kbuild-all
On Wednesday 9 October 2019 08:51:10 CEST Rong Chen wrote:
> On 10/7/19 4:36 PM, Jerome Pouiller wrote:
> > On Friday 4 October 2019 12:48:32 CEST kbuild test robot wrote:
> > [...]
> >>>> drivers/staging/wfx/main.c:47:14-21: ERROR: PTR_ERR applied after initialization to constant on line 42
> >> vim +47 drivers/staging/wfx/main.c
> >>
> >> 30
> >> 31 struct gpio_desc *wfx_get_gpio(struct device *dev, int override, const char *label)
> >> 32 {
> >> 33 struct gpio_desc *ret;
> >> 34 char label_buf[256];
> >> 35
> >> 36 if (override >= 0) {
> >> 37 snprintf(label_buf, sizeof(label_buf), "wfx_%s", label);
> >> 38 ret = ERR_PTR(devm_gpio_request_one(dev, override, GPIOF_OUT_INIT_LOW, label_buf));
> >> 39 if (!ret)
> >> 40 ret = gpio_to_desc(override);
> >> 41 } else if (override == -1) {
> >> > 42 ret = NULL;
> >> 43 } else {
> >> 44 ret = devm_gpiod_get(dev, label, GPIOD_OUT_LOW);
> >> 45 }
> >> 46 if (IS_ERR(ret) || !ret) {
> >> > 47 if (!ret || PTR_ERR(ret) == -ENOENT)
> >> 48 dev_warn(dev, "gpio %s is not defined\n", label);
> >> 49 else
> >> 50 dev_warn(dev, "error while requesting gpio %s\n", label);
> >> 51 ret = NULL;
> >> 52 } else {
> >> 53 dev_dbg(dev, "using gpio %d for %s\n", desc_to_gpio(ret), label);
> >> 54 }
> >> 55 return ret;
> >> 56 }
> >> 57
> > I think that this report is a false positive or I missed something?
> >
> Sorry for the inconvenience, but we confirmed that the error first
> appeared since commit 0096214a59.
Hi Rong,
Err... I continue to not understand the meaning of this warning. If
override != -1 then ret is not constant, isn't?
--
Jérôme Pouiller
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [staging:staging-testing 41/59] drivers/staging/wfx/main.c:47:14-21: ERROR: PTR_ERR applied after initialization to constant on line 42
2019-10-09 14:21 ` Jerome Pouiller
@ 2019-10-09 15:07 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2019-10-09 15:07 UTC (permalink / raw)
To: Jerome Pouiller; +Cc: devel, Greg Kroah-Hartman, kbuild-all, Rong Chen
On Wed, Oct 09, 2019 at 02:21:47PM +0000, Jerome Pouiller wrote:
> On Wednesday 9 October 2019 08:51:10 CEST Rong Chen wrote:
> > On 10/7/19 4:36 PM, Jerome Pouiller wrote:
> > > On Friday 4 October 2019 12:48:32 CEST kbuild test robot wrote:
> > > [...]
> > >>>> drivers/staging/wfx/main.c:47:14-21: ERROR: PTR_ERR applied after initialization to constant on line 42
> > >> vim +47 drivers/staging/wfx/main.c
> > >>
> > >> 30
> > >> 31 struct gpio_desc *wfx_get_gpio(struct device *dev, int override, const char *label)
> > >> 32 {
> > >> 33 struct gpio_desc *ret;
> > >> 34 char label_buf[256];
> > >> 35
> > >> 36 if (override >= 0) {
> > >> 37 snprintf(label_buf, sizeof(label_buf), "wfx_%s", label);
> > >> 38 ret = ERR_PTR(devm_gpio_request_one(dev, override, GPIOF_OUT_INIT_LOW, label_buf));
> > >> 39 if (!ret)
> > >> 40 ret = gpio_to_desc(override);
> > >> 41 } else if (override == -1) {
> > >> > 42 ret = NULL;
> > >> 43 } else {
> > >> 44 ret = devm_gpiod_get(dev, label, GPIOD_OUT_LOW);
> > >> 45 }
> > >> 46 if (IS_ERR(ret) || !ret) {
> > >> > 47 if (!ret || PTR_ERR(ret) == -ENOENT)
> > >> 48 dev_warn(dev, "gpio %s is not defined\n", label);
> > >> 49 else
> > >> 50 dev_warn(dev, "error while requesting gpio %s\n", label);
> > >> 51 ret = NULL;
> > >> 52 } else {
> > >> 53 dev_dbg(dev, "using gpio %d for %s\n", desc_to_gpio(ret), label);
> > >> 54 }
> > >> 55 return ret;
> > >> 56 }
> > >> 57
> > > I think that this report is a false positive or I missed something?
> > >
> > Sorry for the inconvenience, but we confirmed that the error first
> > appeared since commit 0096214a59.
>
> Hi Rong,
>
> Err... I continue to not understand the meaning of this warning. If
> override != -1 then ret is not constant, isn't?
It's a false positive. Those happen. Just ignore it.
regards,
dan carpenter
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-10-09 15:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-04 10:48 [staging:staging-testing 41/59] drivers/staging/wfx/main.c:47:14-21: ERROR: PTR_ERR applied after initialization to constant on line 42 kbuild test robot
2019-10-07 8:36 ` Jerome Pouiller
2019-10-07 8:57 ` Greg Kroah-Hartman
2019-10-09 6:50 ` Rong Chen
2019-10-09 14:21 ` Jerome Pouiller
2019-10-09 15:07 ` Dan Carpenter
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).