Skip to contentSkip to conversation

Patch "bus: sunxi-rsb: Fix error handling in sunxi_rsb_init()" has been added to the 5.10-stable tree

DISCUSSION Jernej Škrabec 2 participants 2 messages Feb 6, 2023 – Feb 7, 2023 1 message not in the archive Stable branch

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi Sasha!

Dne ponedeljek, 06. februar 2023 ob 14:45:06 CET je Sasha Levin napisal(a):

Quoted 64 lines

This is a note to let you know that I've just added the patch titled

bus: sunxi-rsb: Fix error handling in sunxi_rsb_init()

to the 5.10-stable tree which can be found at:

http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum
mary

The filename of the patch is:
bus-sunxi-rsb-fix-error-handling-in-sunxi_rsb_init.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

commit ad954fdfb62b7541a93ce1a12da025a8f698d8a8

Author: Yuan Can <[email protected]>
Date:   Wed Nov 23 09:42:00 2022 +0000

bus: sunxi-rsb: Fix error handling in sunxi_rsb_init()

[ Upstream commit f71eaf2708be7831428eacae7db25d8ec6b8b4c5 ]

The sunxi_rsb_init() returns the platform_driver_register() directly without checking its return value, if platform_driver_register() failed,
the sunxi_rsb_bus is not unregistered.
Fix by unregister sunxi_rsb_bus when platform_driver_register() failed.

Fixes d787dcdb9c8f ("bus: sunxi-rsb: Add driver for Allwinner Reduced

Serial Bus") Signed-off-by: Yuan Can <[email protected]>

Link:
https://lore.kernel.org/r/[email protected]

drivers/bus/sunxi-rsb.c +7 -1
index f8c29b888e6b..98cbb18f17fa 100644
@@ -781,7 +781,13 @@ static int __init sunxi_rsb_init(void)
 		return ret;
 	}
 
-	return platform_driver_register(&sunxi_rsb_driver);
+	ret = platform_driver_register(&sunxi_rsb_driver);
+	if (ret) {
+		bus_unregister(&sunxi_rsb_bus);
+		return ret;
+	}
+
+	return 0;
 }
 module_init(sunxi_rsb_init);
 
(quoted diff) +0 -0

b/sound/soc/intel/boards/bytcr_rt5651.c index bf8b87d45cb0..2c76f0abeeca 100644

sound/soc/intel/boards/bytcr_rt5651.c static int snd_byt_rt5651_mc_probe(struct · line 919

Quoted 2 lines
sound/soc/intel/boards/bytcr_rt5651.c +0 -0
@@ -918,7 +918,6 @@ static int snd_byt_rt5651_mc_probe(struct
 platform_device *pdev) if (adev) {
 		snprintf(byt_rt5651_codec_name, 

sizeof(byt_rt5651_codec_name),

sound/soc/intel/boards/bytcr_rt5651.c static int snd_byt_rt5651_mc_probe(struct · line 921

Quoted 3 lines
sound/soc/intel/boards/bytcr_rt5651.c +0 -1
 			 "i2c-%s", acpi_dev_name(adev));
-		put_device(&adev->dev);
 		byt_rt5651_dais[dai_index].codecs->name = 

byt_rt5651_codec_name;

sound/soc/intel/boards/bytcr_rt5651.c static int snd_byt_rt5651_mc_probe(struct · line 923

Quoted 2 lines
sound/soc/intel/boards/bytcr_rt5651.c +0 -0
 	} else {
 		dev_err(&pdev->dev, "Error cannot find '%s' dev\n", 

mach->id);

sound/soc/intel/boards/bytcr_rt5651.c static int snd_byt_rt5651_mc_probe(struct · line 929

Quoted 5 lines
sound/soc/intel/boards/bytcr_rt5651.c +0 -0
@@ -927,6 +926,7 @@ static int snd_byt_rt5651_mc_probe(struct
 platform_device *pdev)
 
 	codec_dev = bus_find_device_by_name(&i2c_bus_type, NULL,
 

byt_rt5651_codec_name);

sound/soc/intel/boards/bytcr_rt5651.c static int snd_byt_rt5651_mc_probe(struct · line 932

Quoted 3 lines
sound/soc/intel/boards/bytcr_rt5651.c +1 -0
+	acpi_dev_put(adev);
 	if (!codec_dev)
 		return -EPROBE_DEFER;

Above bytcr_rt5651.c changes are unrelated to original commit. Did you merge two commits by mistake?

Best regards,
Jernej

#2 lore raw
Quoted 83 lines · Jernej Škrabec

Hi Sasha!

Dne ponedeljek, 06. februar 2023 ob 14:45:06 CET je Sasha Levin napisal(a):

Quoted 64 lines

This is a note to let you know that I've just added the patch titled

bus: sunxi-rsb: Fix error handling in sunxi_rsb_init()

to the 5.10-stable tree which can be found at:

http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum
mary

The filename of the patch is:
bus-sunxi-rsb-fix-error-handling-in-sunxi_rsb_init.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

commit ad954fdfb62b7541a93ce1a12da025a8f698d8a8

Author: Yuan Can <[email protected]>
Date:   Wed Nov 23 09:42:00 2022 +0000

bus: sunxi-rsb: Fix error handling in sunxi_rsb_init()

[ Upstream commit f71eaf2708be7831428eacae7db25d8ec6b8b4c5 ]

The sunxi_rsb_init() returns the platform_driver_register() directly without checking its return value, if platform_driver_register() failed,
the sunxi_rsb_bus is not unregistered.
Fix by unregister sunxi_rsb_bus when platform_driver_register() failed.

Fixes d787dcdb9c8f ("bus: sunxi-rsb: Add driver for Allwinner Reduced

Serial Bus") Signed-off-by: Yuan Can <[email protected]>

Link:
https://lore.kernel.org/r/[email protected]

drivers/bus/sunxi-rsb.c +7 -1
index f8c29b888e6b..98cbb18f17fa 100644
@@ -781,7 +781,13 @@ static int __init sunxi_rsb_init(void)
 		return ret;
 	}
 
-	return platform_driver_register(&sunxi_rsb_driver);
+	ret = platform_driver_register(&sunxi_rsb_driver);
+	if (ret) {
+		bus_unregister(&sunxi_rsb_bus);
+		return ret;
+	}
+
+	return 0;
 }
 module_init(sunxi_rsb_init);
 
(quoted diff) +0 -0

b/sound/soc/intel/boards/bytcr_rt5651.c index bf8b87d45cb0..2c76f0abeeca 100644

sound/soc/intel/boards/bytcr_rt5651.c static int snd_byt_rt5651_mc_probe(struct · line 919

Quoted 2 lines
sound/soc/intel/boards/bytcr_rt5651.c +0 -0
@@ -918,7 +918,6 @@ static int snd_byt_rt5651_mc_probe(struct
 platform_device *pdev) if (adev) {
 		snprintf(byt_rt5651_codec_name, 

sizeof(byt_rt5651_codec_name),

sound/soc/intel/boards/bytcr_rt5651.c static int snd_byt_rt5651_mc_probe(struct · line 921

Quoted 3 lines
sound/soc/intel/boards/bytcr_rt5651.c +0 -1
 			 "i2c-%s", acpi_dev_name(adev));
-		put_device(&adev->dev);
 		byt_rt5651_dais[dai_index].codecs->name = 

byt_rt5651_codec_name;

sound/soc/intel/boards/bytcr_rt5651.c static int snd_byt_rt5651_mc_probe(struct · line 923

Quoted 2 lines
sound/soc/intel/boards/bytcr_rt5651.c +0 -0
 	} else {
 		dev_err(&pdev->dev, "Error cannot find '%s' dev\n", 

mach->id);

sound/soc/intel/boards/bytcr_rt5651.c static int snd_byt_rt5651_mc_probe(struct · line 929

Quoted 5 lines
sound/soc/intel/boards/bytcr_rt5651.c +0 -0
@@ -927,6 +926,7 @@ static int snd_byt_rt5651_mc_probe(struct
 platform_device *pdev)
 
 	codec_dev = bus_find_device_by_name(&i2c_bus_type, NULL,
 

byt_rt5651_codec_name);

Quoted 6 lines

sound/soc/intel/boards/bytcr_rt5651.c static int snd_byt_rt5651_mc_probe(struct · line 932

Quoted 3 lines
sound/soc/intel/boards/bytcr_rt5651.c +1 -0
+	acpi_dev_put(adev);
 	if (!codec_dev)
 		return -EPROBE_DEFER;

Above bytcr_rt5651.c changes are unrelated to original commit. Did you merge two commits by mistake?

Yes, something went wrong, I've dropped that chunk now.

thanks for the review!

greg k-h