diff mbox series

spi: spi-xilinx: fix for_each_child.cocci warnings

Message ID alpine.DEB.2.22.394.2202082148490.52266@hadrien (mailing list archive)
State New, archived
Headers show
Series spi: spi-xilinx: fix for_each_child.cocci warnings | expand

Commit Message

Julia Lawall Feb. 8, 2022, 8:51 p.m. UTC
From: kernel test robot <lkp@intel.com>

After for_each_available_child_of_node, of_node_put is needed before break
and return.

Generated by: scripts/coccinelle/iterators/for_each_child.cocci

Fixes: 3973536c4560 ("spi: spi-xilinx: Updated axi-qspi controller driver")
CC: Amit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
---

tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.15
head:   1183ce490adb103e5e569b8ebd74c50c885ddc05
commit: 3973536c456079bf3d09e9a97bf33d29422b183f [861/872] spi: spi-xilinx: Updated axi-qspi controller driver
:::::: branch date: 7 days ago
:::::: commit date: 7 days ago

 spi-xilinx.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Ricardo Ribalda Delgado Feb. 9, 2022, 10:33 a.m. UTC | #1
On Tue, Feb 8, 2022 at 9:51 PM Julia Lawall <julia.lawall@inria.fr> wrote:
>
> From: kernel test robot <lkp@intel.com>
>
> After for_each_available_child_of_node, of_node_put is needed before break
> and return.
>
> Generated by: scripts/coccinelle/iterators/for_each_child.cocci
>
> Fixes: 3973536c4560 ("spi: spi-xilinx: Updated axi-qspi controller driver")
> CC: Amit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Julia Lawall <julia.lawall@inria.fr>

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
>
> tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.15
> head:   1183ce490adb103e5e569b8ebd74c50c885ddc05
> commit: 3973536c456079bf3d09e9a97bf33d29422b183f [861/872] spi: spi-xilinx: Updated axi-qspi controller driver
> :::::: branch date: 7 days ago
> :::::: commit date: 7 days ago
>
>  spi-xilinx.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> --- a/drivers/spi/spi-xilinx.c
> +++ b/drivers/spi/spi-xilinx.c
> @@ -693,13 +693,16 @@ static int xilinx_spi_probe(struct platf
>                 if (startup_block) {
>                         ret = of_property_read_u32(nc, "reg",
>                                                    &cs_num);
> -                       if (ret < 0)
> +                       if (ret < 0) {
> +                               of_node_put(nc);
>                                 return -EINVAL;
> +                       }
>                 }
>                 ret = of_property_read_u32(nc, "spi-rx-bus-width",
>                                            &rx_bus_width);
>                 if (!ret) {
>                         xspi->rx_bus_width = rx_bus_width;
> +                       of_node_put(nc);
>                         break;
>                 }
>         }
Mark Brown Feb. 9, 2022, 1:12 p.m. UTC | #2
On Wed, Feb 09, 2022 at 11:33:34AM +0100, Ricardo Ribalda Delgado wrote:
> On Tue, Feb 8, 2022 at 9:51 PM Julia Lawall <julia.lawall@inria.fr> wrote:

> > Fixes: 3973536c4560 ("spi: spi-xilinx: Updated axi-qspi controller driver")
> > CC: Amit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>
> > Reported-by: kernel test robot <lkp@intel.com>
> > Signed-off-by: kernel test robot <lkp@intel.com>
> > Signed-off-by: Julia Lawall <julia.lawall@inria.fr>

> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>

That's not what Signed-off-by means, you should only be adding a signoff
if you're forwarding on a patch or you wrote it - please see
Documentation/process/submitting-patches.rst for details on what this is
and why it's important.  You probably meant an ack or a review.
Mark Brown Feb. 9, 2022, 1:25 p.m. UTC | #3
On Tue, Feb 08, 2022 at 09:51:30PM +0100, Julia Lawall wrote:
> From: kernel test robot <lkp@intel.com>
> 
> After for_each_available_child_of_node, of_node_put is needed before break
> and return.

This doesn't apply against current code, please check and resend.
Ricardo Ribalda Delgado Feb. 9, 2022, 1:52 p.m. UTC | #4
Hi Mark

On Wed, Feb 9, 2022 at 2:12 PM Mark Brown <broonie@kernel.org> wrote:
>
> On Wed, Feb 09, 2022 at 11:33:34AM +0100, Ricardo Ribalda Delgado wrote:
> > On Tue, Feb 8, 2022 at 9:51 PM Julia Lawall <julia.lawall@inria.fr> wrote:
>
> > > Fixes: 3973536c4560 ("spi: spi-xilinx: Updated axi-qspi controller driver")
> > > CC: Amit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > Signed-off-by: kernel test robot <lkp@intel.com>
> > > Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
>
> > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
>
> That's not what Signed-off-by means, you should only be adding a signoff
> if you're forwarding on a patch or you wrote it - please see
> Documentation/process/submitting-patches.rst for details on what this is
> and why it's important.  You probably meant an ack or a review.

Sorry, I pressed the wrong shortcut. My apologies.

I meant ack
diff mbox series

Patch

--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -693,13 +693,16 @@  static int xilinx_spi_probe(struct platf
 		if (startup_block) {
 			ret = of_property_read_u32(nc, "reg",
 						   &cs_num);
-			if (ret < 0)
+			if (ret < 0) {
+				of_node_put(nc);
 				return -EINVAL;
+			}
 		}
 		ret = of_property_read_u32(nc, "spi-rx-bus-width",
 					   &rx_bus_width);
 		if (!ret) {
 			xspi->rx_bus_width = rx_bus_width;
+			of_node_put(nc);
 			break;
 		}
 	}