All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 22/24] Input: bcm-keypad - Simplify with dev_err_probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: " Krzysztof Kozlowski
@ 2023-06-25 16:28 ` Krzysztof Kozlowski
  2023-06-26 13:05   ` Dan Carpenter
  0 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:28 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä, linux-input,
	linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

Common pattern of handling deferred probe can be simplified with
dev_err_probe() and devm_clk_get_optional().  Less code and the error
value gets printed.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

---

Changes since v1:
1. Use also devm_clk_get_optional()
---
 drivers/input/keyboard/bcm-keypad.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/input/keyboard/bcm-keypad.c b/drivers/input/keyboard/bcm-keypad.c
index 56a919ec23b5..05b09066df84 100644
--- a/drivers/input/keyboard/bcm-keypad.c
+++ b/drivers/input/keyboard/bcm-keypad.c
@@ -365,17 +365,11 @@ static int bcm_kp_probe(struct platform_device *pdev)
 		return PTR_ERR(kp->base);
 
 	/* Enable clock */
-	kp->clk = devm_clk_get(&pdev->dev, "peri_clk");
+	kp->clk = devm_clk_get_optional(&pdev->dev, "peri_clk");
 	if (IS_ERR(kp->clk)) {
-		error = PTR_ERR(kp->clk);
-		if (error != -ENOENT) {
-			if (error != -EPROBE_DEFER)
-				dev_err(&pdev->dev, "Failed to get clock\n");
-			return error;
-		}
-		dev_dbg(&pdev->dev,
-			"No clock specified. Assuming it's enabled\n");
-		kp->clk = NULL;
+		return dev_err_probe(&pdev->dev, error, "Failed to get clock\n");
+	} else if (!kp->clk) {
+		dev_dbg(&pdev->dev, "No clock specified. Assuming it's enabled\n");
 	} else {
 		unsigned int desired_rate;
 		long actual_rate;
-- 
2.34.1


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

* Re: [PATCH v4 22/24] Input: bcm-keypad - Simplify with dev_err_probe()
@ 2023-06-26  7:19 kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2023-06-26  7:19 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20230625162817.100397-23-krzysztof.kozlowski@linaro.org>
References: <20230625162817.100397-23-krzysztof.kozlowski@linaro.org>
TO: Krzysztof Kozlowski <krzk@kernel.org>

Hi Krzysztof,

kernel test robot noticed the following build warnings:

[auto build test WARNING on dtor-input/next]
[also build test WARNING on next-20230623]
[cannot apply to dtor-input/for-linus linus/master v6.4]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Krzysztof-Kozlowski/Input-gpio_keys_polled-Simplify-with-dev_err_probe/20230626-003156
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
patch link:    https://lore.kernel.org/r/20230625162817.100397-23-krzysztof.kozlowski%40linaro.org
patch subject: [PATCH v4 22/24] Input: bcm-keypad - Simplify with dev_err_probe()
:::::: branch date: 15 hours ago
:::::: commit date: 15 hours ago
config: i386-randconfig-m021-20230625 (https://download.01.org/0day-ci/archive/20230626/202306261505.wTjCXRIO-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230626/202306261505.wTjCXRIO-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202306261505.wTjCXRIO-lkp@intel.com/

smatch warnings:
drivers/input/keyboard/bcm-keypad.c:370 bcm_kp_probe() warn: passing zero to 'dev_err_probe'

vim +/dev_err_probe +370 drivers/input/keyboard/bcm-keypad.c

0c7e67a928ac53 Scott Branden       2015-02-28  304  
0c7e67a928ac53 Scott Branden       2015-02-28  305  
0c7e67a928ac53 Scott Branden       2015-02-28  306  static int bcm_kp_probe(struct platform_device *pdev)
0c7e67a928ac53 Scott Branden       2015-02-28  307  {
0c7e67a928ac53 Scott Branden       2015-02-28  308  	struct bcm_kp *kp;
0c7e67a928ac53 Scott Branden       2015-02-28  309  	struct input_dev *input_dev;
0c7e67a928ac53 Scott Branden       2015-02-28  310  	struct resource *res;
0c7e67a928ac53 Scott Branden       2015-02-28  311  	int error;
0c7e67a928ac53 Scott Branden       2015-02-28  312  
0c7e67a928ac53 Scott Branden       2015-02-28  313  	kp = devm_kzalloc(&pdev->dev, sizeof(*kp), GFP_KERNEL);
0c7e67a928ac53 Scott Branden       2015-02-28  314  	if (!kp)
0c7e67a928ac53 Scott Branden       2015-02-28  315  		return -ENOMEM;
0c7e67a928ac53 Scott Branden       2015-02-28  316  
0c7e67a928ac53 Scott Branden       2015-02-28  317  	input_dev = devm_input_allocate_device(&pdev->dev);
0c7e67a928ac53 Scott Branden       2015-02-28  318  	if (!input_dev) {
0c7e67a928ac53 Scott Branden       2015-02-28  319  		dev_err(&pdev->dev, "failed to allocate the input device\n");
0c7e67a928ac53 Scott Branden       2015-02-28  320  		return -ENOMEM;
0c7e67a928ac53 Scott Branden       2015-02-28  321  	}
0c7e67a928ac53 Scott Branden       2015-02-28  322  
0c7e67a928ac53 Scott Branden       2015-02-28  323  	__set_bit(EV_KEY, input_dev->evbit);
0c7e67a928ac53 Scott Branden       2015-02-28  324  
0c7e67a928ac53 Scott Branden       2015-02-28  325  	/* Enable auto repeat feature of Linux input subsystem */
0c7e67a928ac53 Scott Branden       2015-02-28  326  	if (of_property_read_bool(pdev->dev.of_node, "autorepeat"))
0c7e67a928ac53 Scott Branden       2015-02-28  327  		__set_bit(EV_REP, input_dev->evbit);
0c7e67a928ac53 Scott Branden       2015-02-28  328  
0c7e67a928ac53 Scott Branden       2015-02-28  329  	input_dev->name = pdev->name;
0c7e67a928ac53 Scott Branden       2015-02-28  330  	input_dev->phys = "keypad/input0";
0c7e67a928ac53 Scott Branden       2015-02-28  331  	input_dev->dev.parent = &pdev->dev;
0c7e67a928ac53 Scott Branden       2015-02-28  332  	input_dev->open = bcm_kp_open;
0c7e67a928ac53 Scott Branden       2015-02-28  333  	input_dev->close = bcm_kp_close;
0c7e67a928ac53 Scott Branden       2015-02-28  334  
0c7e67a928ac53 Scott Branden       2015-02-28  335  	input_dev->id.bustype = BUS_HOST;
0c7e67a928ac53 Scott Branden       2015-02-28  336  	input_dev->id.vendor = 0x0001;
0c7e67a928ac53 Scott Branden       2015-02-28  337  	input_dev->id.product = 0x0001;
0c7e67a928ac53 Scott Branden       2015-02-28  338  	input_dev->id.version = 0x0100;
0c7e67a928ac53 Scott Branden       2015-02-28  339  
0c7e67a928ac53 Scott Branden       2015-02-28  340  	input_set_drvdata(input_dev, kp);
0c7e67a928ac53 Scott Branden       2015-02-28  341  
0c7e67a928ac53 Scott Branden       2015-02-28  342  	kp->input_dev = input_dev;
0c7e67a928ac53 Scott Branden       2015-02-28  343  
0c7e67a928ac53 Scott Branden       2015-02-28  344  	error = bcm_kp_matrix_key_parse_dt(kp);
0c7e67a928ac53 Scott Branden       2015-02-28  345  	if (error)
0c7e67a928ac53 Scott Branden       2015-02-28  346  		return error;
0c7e67a928ac53 Scott Branden       2015-02-28  347  
0c7e67a928ac53 Scott Branden       2015-02-28  348  	error = matrix_keypad_build_keymap(NULL, NULL,
0c7e67a928ac53 Scott Branden       2015-02-28  349  					   kp->n_rows, kp->n_cols,
0c7e67a928ac53 Scott Branden       2015-02-28  350  					   NULL, input_dev);
0c7e67a928ac53 Scott Branden       2015-02-28  351  	if (error) {
0c7e67a928ac53 Scott Branden       2015-02-28  352  		dev_err(&pdev->dev, "failed to build keymap\n");
0c7e67a928ac53 Scott Branden       2015-02-28  353  		return error;
0c7e67a928ac53 Scott Branden       2015-02-28  354  	}
0c7e67a928ac53 Scott Branden       2015-02-28  355  
0c7e67a928ac53 Scott Branden       2015-02-28  356  	/* Get the KEYPAD base address */
0c7e67a928ac53 Scott Branden       2015-02-28  357  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
0c7e67a928ac53 Scott Branden       2015-02-28  358  	if (!res) {
0c7e67a928ac53 Scott Branden       2015-02-28  359  		dev_err(&pdev->dev, "Missing keypad base address resource\n");
0c7e67a928ac53 Scott Branden       2015-02-28  360  		return -ENODEV;
0c7e67a928ac53 Scott Branden       2015-02-28  361  	}
0c7e67a928ac53 Scott Branden       2015-02-28  362  
0c7e67a928ac53 Scott Branden       2015-02-28  363  	kp->base = devm_ioremap_resource(&pdev->dev, res);
0c7e67a928ac53 Scott Branden       2015-02-28  364  	if (IS_ERR(kp->base))
0c7e67a928ac53 Scott Branden       2015-02-28  365  		return PTR_ERR(kp->base);
0c7e67a928ac53 Scott Branden       2015-02-28  366  
0c7e67a928ac53 Scott Branden       2015-02-28  367  	/* Enable clock */
5d0380bcb07530 Krzysztof Kozlowski 2023-06-25  368  	kp->clk = devm_clk_get_optional(&pdev->dev, "peri_clk");
0c7e67a928ac53 Scott Branden       2015-02-28  369  	if (IS_ERR(kp->clk)) {
5d0380bcb07530 Krzysztof Kozlowski 2023-06-25 @370  		return dev_err_probe(&pdev->dev, error, "Failed to get clock\n");
5d0380bcb07530 Krzysztof Kozlowski 2023-06-25  371  	} else if (!kp->clk) {
5d0380bcb07530 Krzysztof Kozlowski 2023-06-25  372  		dev_dbg(&pdev->dev, "No clock specified. Assuming it's enabled\n");
0c7e67a928ac53 Scott Branden       2015-02-28  373  	} else {
0c7e67a928ac53 Scott Branden       2015-02-28  374  		unsigned int desired_rate;
0c7e67a928ac53 Scott Branden       2015-02-28  375  		long actual_rate;
0c7e67a928ac53 Scott Branden       2015-02-28  376  
0c7e67a928ac53 Scott Branden       2015-02-28  377  		error = of_property_read_u32(pdev->dev.of_node,
0c7e67a928ac53 Scott Branden       2015-02-28  378  					     "clock-frequency", &desired_rate);
0c7e67a928ac53 Scott Branden       2015-02-28  379  		if (error < 0)
0c7e67a928ac53 Scott Branden       2015-02-28  380  			desired_rate = DEFAULT_CLK_HZ;
0c7e67a928ac53 Scott Branden       2015-02-28  381  
0c7e67a928ac53 Scott Branden       2015-02-28  382  		actual_rate = clk_round_rate(kp->clk, desired_rate);
0c7e67a928ac53 Scott Branden       2015-02-28  383  		if (actual_rate <= 0)
0c7e67a928ac53 Scott Branden       2015-02-28  384  			return -EINVAL;
0c7e67a928ac53 Scott Branden       2015-02-28  385  
0c7e67a928ac53 Scott Branden       2015-02-28  386  		error = clk_set_rate(kp->clk, actual_rate);
0c7e67a928ac53 Scott Branden       2015-02-28  387  		if (error)
0c7e67a928ac53 Scott Branden       2015-02-28  388  			return error;
0c7e67a928ac53 Scott Branden       2015-02-28  389  
0c7e67a928ac53 Scott Branden       2015-02-28  390  		error = clk_prepare_enable(kp->clk);
0c7e67a928ac53 Scott Branden       2015-02-28  391  		if (error)
0c7e67a928ac53 Scott Branden       2015-02-28  392  			return error;
0c7e67a928ac53 Scott Branden       2015-02-28  393  	}
0c7e67a928ac53 Scott Branden       2015-02-28  394  
0c7e67a928ac53 Scott Branden       2015-02-28  395  	/* Put the kp into a known sane state */
0c7e67a928ac53 Scott Branden       2015-02-28  396  	bcm_kp_stop(kp);
0c7e67a928ac53 Scott Branden       2015-02-28  397  
0c7e67a928ac53 Scott Branden       2015-02-28  398  	kp->irq = platform_get_irq(pdev, 0);
0bec8b7e5ca1a6 Stephen Boyd        2019-08-14  399  	if (kp->irq < 0)
0c7e67a928ac53 Scott Branden       2015-02-28  400  		return -EINVAL;
0c7e67a928ac53 Scott Branden       2015-02-28  401  
0c7e67a928ac53 Scott Branden       2015-02-28  402  	error = devm_request_threaded_irq(&pdev->dev, kp->irq,
0c7e67a928ac53 Scott Branden       2015-02-28  403  					  NULL, bcm_kp_isr_thread,
0c7e67a928ac53 Scott Branden       2015-02-28  404  					  IRQF_ONESHOT, pdev->name, kp);
0c7e67a928ac53 Scott Branden       2015-02-28  405  	if (error) {
0c7e67a928ac53 Scott Branden       2015-02-28  406  		dev_err(&pdev->dev, "failed to request IRQ\n");
0c7e67a928ac53 Scott Branden       2015-02-28  407  		return error;
0c7e67a928ac53 Scott Branden       2015-02-28  408  	}
0c7e67a928ac53 Scott Branden       2015-02-28  409  
0c7e67a928ac53 Scott Branden       2015-02-28  410  	error = input_register_device(input_dev);
0c7e67a928ac53 Scott Branden       2015-02-28  411  	if (error) {
0c7e67a928ac53 Scott Branden       2015-02-28  412  		dev_err(&pdev->dev, "failed to register input device\n");
0c7e67a928ac53 Scott Branden       2015-02-28  413  		return error;
0c7e67a928ac53 Scott Branden       2015-02-28  414  	}
0c7e67a928ac53 Scott Branden       2015-02-28  415  
0c7e67a928ac53 Scott Branden       2015-02-28  416  	return 0;
0c7e67a928ac53 Scott Branden       2015-02-28  417  }
0c7e67a928ac53 Scott Branden       2015-02-28  418  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH v4 22/24] Input: bcm-keypad - Simplify with dev_err_probe()
  2023-06-25 16:28 ` [PATCH v4 22/24] Input: bcm-keypad - " Krzysztof Kozlowski
@ 2023-06-26 13:05   ` Dan Carpenter
  2023-06-27  8:57     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2023-06-26 13:05 UTC (permalink / raw)
  To: oe-kbuild, Krzysztof Kozlowski; +Cc: lkp, oe-kbuild-all

Hi Krzysztof,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Krzysztof-Kozlowski/Input-gpio_keys_polled-Simplify-with-dev_err_probe/20230626-003156
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
patch link:    https://lore.kernel.org/r/20230625162817.100397-23-krzysztof.kozlowski%40linaro.org
patch subject: [PATCH v4 22/24] Input: bcm-keypad - Simplify with dev_err_probe()
config: i386-randconfig-m021-20230625 (https://download.01.org/0day-ci/archive/20230626/202306261505.wTjCXRIO-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230626/202306261505.wTjCXRIO-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202306261505.wTjCXRIO-lkp@intel.com/

smatch warnings:
drivers/input/keyboard/bcm-keypad.c:370 bcm_kp_probe() warn: passing zero to 'dev_err_probe'

vim +/dev_err_probe +370 drivers/input/keyboard/bcm-keypad.c

0c7e67a928ac53 Scott Branden       2015-02-28  348  	error = matrix_keypad_build_keymap(NULL, NULL,
0c7e67a928ac53 Scott Branden       2015-02-28  349  					   kp->n_rows, kp->n_cols,
0c7e67a928ac53 Scott Branden       2015-02-28  350  					   NULL, input_dev);
0c7e67a928ac53 Scott Branden       2015-02-28  351  	if (error) {
0c7e67a928ac53 Scott Branden       2015-02-28  352  		dev_err(&pdev->dev, "failed to build keymap\n");
0c7e67a928ac53 Scott Branden       2015-02-28  353  		return error;
0c7e67a928ac53 Scott Branden       2015-02-28  354  	}
0c7e67a928ac53 Scott Branden       2015-02-28  355  
0c7e67a928ac53 Scott Branden       2015-02-28  356  	/* Get the KEYPAD base address */
0c7e67a928ac53 Scott Branden       2015-02-28  357  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
0c7e67a928ac53 Scott Branden       2015-02-28  358  	if (!res) {
0c7e67a928ac53 Scott Branden       2015-02-28  359  		dev_err(&pdev->dev, "Missing keypad base address resource\n");
0c7e67a928ac53 Scott Branden       2015-02-28  360  		return -ENODEV;
0c7e67a928ac53 Scott Branden       2015-02-28  361  	}
0c7e67a928ac53 Scott Branden       2015-02-28  362  
0c7e67a928ac53 Scott Branden       2015-02-28  363  	kp->base = devm_ioremap_resource(&pdev->dev, res);
0c7e67a928ac53 Scott Branden       2015-02-28  364  	if (IS_ERR(kp->base))
0c7e67a928ac53 Scott Branden       2015-02-28  365  		return PTR_ERR(kp->base);
0c7e67a928ac53 Scott Branden       2015-02-28  366  
0c7e67a928ac53 Scott Branden       2015-02-28  367  	/* Enable clock */
5d0380bcb07530 Krzysztof Kozlowski 2023-06-25  368  	kp->clk = devm_clk_get_optional(&pdev->dev, "peri_clk");
0c7e67a928ac53 Scott Branden       2015-02-28  369  	if (IS_ERR(kp->clk)) {
5d0380bcb07530 Krzysztof Kozlowski 2023-06-25 @370  		return dev_err_probe(&pdev->dev, error, "Failed to get clock\n");

s/error/PTR_ERR(kp->clk)/

5d0380bcb07530 Krzysztof Kozlowski 2023-06-25  371  	} else if (!kp->clk) {
5d0380bcb07530 Krzysztof Kozlowski 2023-06-25  372  		dev_dbg(&pdev->dev, "No clock specified. Assuming it's enabled\n");
0c7e67a928ac53 Scott Branden       2015-02-28  373  	} else {
0c7e67a928ac53 Scott Branden       2015-02-28  374  		unsigned int desired_rate;
0c7e67a928ac53 Scott Branden       2015-02-28  375  		long actual_rate;
0c7e67a928ac53 Scott Branden       2015-02-28  376  
0c7e67a928ac53 Scott Branden       2015-02-28  377  		error = of_property_read_u32(pdev->dev.of_node,

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


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

* Re: [PATCH v4 22/24] Input: bcm-keypad - Simplify with dev_err_probe()
  2023-06-26 13:05   ` Dan Carpenter
@ 2023-06-27  8:57     ` Krzysztof Kozlowski
  2023-06-27 10:01       ` Dan Carpenter
  0 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-27  8:57 UTC (permalink / raw)
  To: Dan Carpenter, oe-kbuild; +Cc: lkp, oe-kbuild-all

On 26/06/2023 15:05, Dan Carpenter wrote:
> Hi Krzysztof,
> 
> kernel test robot noticed the following build warnings:
> 
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Krzysztof-Kozlowski/Input-gpio_keys_polled-Simplify-with-dev_err_probe/20230626-003156
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
> patch link:    https://lore.kernel.org/r/20230625162817.100397-23-krzysztof.kozlowski%40linaro.org
> patch subject: [PATCH v4 22/24] Input: bcm-keypad - Simplify with dev_err_probe()
> config: i386-randconfig-m021-20230625 (https://download.01.org/0day-ci/archive/20230626/202306261505.wTjCXRIO-lkp@intel.com/config)
> compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> reproduce: (https://download.01.org/0day-ci/archive/20230626/202306261505.wTjCXRIO-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> | Closes: https://lore.kernel.org/r/202306261505.wTjCXRIO-lkp@intel.com/

Thanks. I run smatch on the patchset before sending and did not point it
out. Nothing also after pulling latest master. I guess you run some
unreleased version?

Best regards,
Krzysztof


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

* Re: [PATCH v4 22/24] Input: bcm-keypad - Simplify with dev_err_probe()
  2023-06-27  8:57     ` Krzysztof Kozlowski
@ 2023-06-27 10:01       ` Dan Carpenter
  2023-06-27 10:35         ` Krzysztof Kozlowski
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2023-06-27 10:01 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: oe-kbuild, lkp, oe-kbuild-all

On Tue, Jun 27, 2023 at 10:57:49AM +0200, Krzysztof Kozlowski wrote:
> On 26/06/2023 15:05, Dan Carpenter wrote:
> > Hi Krzysztof,
> > 
> > kernel test robot noticed the following build warnings:
> > 
> > https://git-scm.com/docs/git-format-patch#_base_tree_information]
> > 
> > url:    https://github.com/intel-lab-lkp/linux/commits/Krzysztof-Kozlowski/Input-gpio_keys_polled-Simplify-with-dev_err_probe/20230626-003156
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
> > patch link:    https://lore.kernel.org/r/20230625162817.100397-23-krzysztof.kozlowski%40linaro.org
> > patch subject: [PATCH v4 22/24] Input: bcm-keypad - Simplify with dev_err_probe()
> > config: i386-randconfig-m021-20230625 (https://download.01.org/0day-ci/archive/20230626/202306261505.wTjCXRIO-lkp@intel.com/config)
> > compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> > reproduce: (https://download.01.org/0day-ci/archive/20230626/202306261505.wTjCXRIO-lkp@intel.com/reproduce)
> > 
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> > | Closes: https://lore.kernel.org/r/202306261505.wTjCXRIO-lkp@intel.com/
> 
> Thanks. I run smatch on the patchset before sending and did not point it
> out. Nothing also after pulling latest master. I guess you run some
> unreleased version?

No, this is the kbuild bot.  It's using released code.  I tested it on
my system as well and it should work...  That warning is newish though
so maybe you're not using the latest Smatch?

$ ~/progs/smatch/release/smatch_scripts/kchecker drivers/input/keyboard/bcm-keypad.c
  CHECK   scripts/mod/empty.c
  CALL    scripts/checksyscalls.sh
  DESCEND objtool
  INSTALL libsubcmd_headers
  CC      drivers/input/keyboard/bcm-keypad.o
  CHECK   drivers/input/keyboard/bcm-keypad.c
drivers/input/keyboard/bcm-keypad.c:370 bcm_kp_probe() warn: passing zero to 'dev_err_probe'

regards,
dan carpenter


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

* Re: [PATCH v4 22/24] Input: bcm-keypad - Simplify with dev_err_probe()
  2023-06-27 10:01       ` Dan Carpenter
@ 2023-06-27 10:35         ` Krzysztof Kozlowski
  2023-06-27 10:46           ` Dan Carpenter
  0 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-27 10:35 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: oe-kbuild, lkp, oe-kbuild-all

On 27/06/2023 12:01, Dan Carpenter wrote:
>>> If you fix the issue in a separate patch/commit (i.e. not just a new version of
>>> the same patch/commit), kindly add following tags
>>> | Reported-by: kernel test robot <lkp@intel.com>
>>> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
>>> | Closes: https://lore.kernel.org/r/202306261505.wTjCXRIO-lkp@intel.com/
>>
>> Thanks. I run smatch on the patchset before sending and did not point it
>> out. Nothing also after pulling latest master. I guess you run some
>> unreleased version?
> 
> No, this is the kbuild bot.  It's using released code.  I tested it on
> my system as well and it should work...  That warning is newish though
> so maybe you're not using the latest Smatch?
> 
> $ ~/progs/smatch/release/smatch_scripts/kchecker drivers/input/keyboard/bcm-keypad.c
>   CHECK   scripts/mod/empty.c
>   CALL    scripts/checksyscalls.sh
>   DESCEND objtool
>   INSTALL libsubcmd_headers
>   CC      drivers/input/keyboard/bcm-keypad.o
>   CHECK   drivers/input/keyboard/bcm-keypad.c
> drivers/input/keyboard/bcm-keypad.c:370 bcm_kp_probe() warn: passing zero to 'dev_err_probe'

It was latest from master:
$ ~/dev/3rdparty/smatch/smatch --version
v0.5.0-8393-gde59d476b2df

I now double checked on x86_64 (previous was cross-compile for arm64 but
it should not matter):

$ x8664_cc make C=1 CHECK="~/dev/3rdparty/smatch/smatch" -j8  drivers/input/keyboard/
make[1]: Entering directory '/home/krzk/dev/linux/linux/out'
  GEN     Makefile
  DESCEND objtool
  INSTALL libsubcmd_headers
  CALL    ../scripts/checksyscalls.sh
  CC      drivers/input/keyboard/bcm-keypad.o
  CHECK   ../drivers/input/keyboard/bcm-keypad.c
  AR      drivers/input/keyboard/built-in.a
make[1]: Leaving directory '/home/krzk/dev/linux/linux/out'

Does the C=1/CHECK method differs from kchecker?

Best regards,
Krzysztof


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

* Re: [PATCH v4 22/24] Input: bcm-keypad - Simplify with dev_err_probe()
  2023-06-27 10:35         ` Krzysztof Kozlowski
@ 2023-06-27 10:46           ` Dan Carpenter
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2023-06-27 10:46 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: oe-kbuild, lkp, oe-kbuild-all

On Tue, Jun 27, 2023 at 12:35:24PM +0200, Krzysztof Kozlowski wrote:
> $ x8664_cc make C=1 CHECK="~/dev/3rdparty/smatch/smatch" -j8  drivers/input/keyboard/
> make[1]: Entering directory '/home/krzk/dev/linux/linux/out'
>   GEN     Makefile
>   DESCEND objtool
>   INSTALL libsubcmd_headers
>   CALL    ../scripts/checksyscalls.sh
>   CC      drivers/input/keyboard/bcm-keypad.o
>   CHECK   ../drivers/input/keyboard/bcm-keypad.c
>   AR      drivers/input/keyboard/built-in.a
> make[1]: Leaving directory '/home/krzk/dev/linux/linux/out'
> 
> Does the C=1/CHECK method differs from kchecker?

Ah...  Yes.  You need to add a -p=kernel to enable the kernel specific
checkes.  I wonder there is some way I could automatically enable that
if I detect you're in a linux kernel directory?

x8664_cc make C=1 CHECK="~/dev/3rdparty/smatch/smatch -p=kernel" -j8 drivers/input/keyboard/

regards,
dan carpenter


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

end of thread, other threads:[~2023-06-27 10:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-26  7:19 [PATCH v4 22/24] Input: bcm-keypad - Simplify with dev_err_probe() kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2023-06-25 16:27 [PATCH v4 00/24] Input: " Krzysztof Kozlowski
2023-06-25 16:28 ` [PATCH v4 22/24] Input: bcm-keypad - " Krzysztof Kozlowski
2023-06-26 13:05   ` Dan Carpenter
2023-06-27  8:57     ` Krzysztof Kozlowski
2023-06-27 10:01       ` Dan Carpenter
2023-06-27 10:35         ` Krzysztof Kozlowski
2023-06-27 10:46           ` Dan Carpenter

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.