mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ppc32: Fix crash on load  in DACA sound driver
@ 2004-03-02 21:30 Benjamin Herrenschmidt
  2004-03-02 23:17 ` [PATCH] ppc32: macserial.c missing variable declaration Wojciech 'Sas' Cieciwa
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2004-03-02 21:30 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linus Torvalds, Linux Kernel list

Hi !

The DACA sound driver (early iBook models) doesn't clear the i2c_client
structure. That cause the embedded struct device (and thus kobject) to
contain garbage in the "k_name" field, which kobject_set_name will
later try to kfree... 
Also removes references to unused struct data_data.

===== sound/oss/dmasound/dac3550a.c 1.2 vs edited =====
--- 1.2/sound/oss/dmasound/dac3550a.c	Tue Sep 30 10:25:28 2003
+++ edited/sound/oss/dmasound/dac3550a.c	Tue Mar  2 21:32:04 2004
@@ -42,11 +42,6 @@
 /* Unique ID allocation */
 static int daca_id;
 
-struct daca_data
-{
-	int arf; /* place holder for furture use */
-};
-
 struct i2c_driver daca_driver = {  
 	.owner			= THIS_MODULE,
 	.name			= "DAC3550A driver  V " DACA_VERSION,
@@ -168,12 +163,12 @@
 {
 	const char *client_name = "DAC 3550A Digital Equalizer";
 	struct i2c_client *new_client;
-	struct daca_data *data;
 	int rc = -ENODEV;
 
-	new_client = kmalloc(sizeof(*new_client) + sizeof(*data), GFP_KERNEL);
+	new_client = kmalloc(sizeof(*new_client), GFP_KERNEL);
 	if (!new_client)
 		return -ENOMEM;
+	memset(new_client, 0, sizeof(*new_client));
 
 	new_client->addr = address;
 	new_client->adapter = adapter;
@@ -181,9 +176,6 @@
 	new_client->flags = 0;
 	strcpy(new_client->name, client_name);
 	new_client->id = daca_id++; /* racy... */
-
-	data = (struct daca_data *)(new_client+1);
-	dev_set_drvdata(&new_client->dev, data);
 
 	if (daca_init_client(new_client))
 		goto bail;



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

* Re: [PATCH] ppc32: macserial.c missing variable declaration
  2004-03-02 23:17 ` [PATCH] ppc32: macserial.c missing variable declaration Wojciech 'Sas' Cieciwa
@ 2004-03-02 22:35   ` Linus Torvalds
  2004-03-02 22:53     ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 4+ messages in thread
From: Linus Torvalds @ 2004-03-02 22:35 UTC (permalink / raw)
  To: Wojciech 'Sas' Cieciwa; +Cc: linux-kernel, Andrew Morton



On Wed, 3 Mar 2004, Wojciech 'Sas' Cieciwa wrote:
>  {
>  	struct mac_serial * info = (struct mac_serial *)tty->driver_data;
>  	unsigned char control, status;
> +	unsigned int cmd;
>  	unsigned long flags;
>  
>  #ifdef CONFIG_KGDB

This can't be right. Those variables are never initialized anywhere.

The usage of 'cmd' should either be removed entirely, or it should be 
passed in as an argument, it looks like. In the meantime, it's better to 
have code that doesn't compile than code that compiles but can't possibly 
do anything sane.

		Linus

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

* Re: [PATCH] ppc32: macserial.c missing variable declaration
  2004-03-02 22:35   ` Linus Torvalds
@ 2004-03-02 22:53     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2004-03-02 22:53 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Wojciech 'Sas' Cieciwa, Linux Kernel list, Andrew Morton


> This can't be right. Those variables are never initialized anywhere.
> 
> The usage of 'cmd' should either be removed entirely, or it should be 
> passed in as an argument, it looks like. In the meantime, it's better to 
> have code that doesn't compile than code that compiles but can't possibly 
> do anything sane.

macserial is obsolete on 2.6. it should be removed. pmac_zilog is the
replacement.

I still haven't found the bug with pmac_zilog that caused the occasional
crash on boot on the G5 though (it seems to be a subtle race, I haven't
found anything wrong with pmac_zilog itself), but then, I've been
quite busy with other things latey.

Ben.



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

* [PATCH] ppc32: macserial.c missing variable declaration
  2004-03-02 21:30 [PATCH] ppc32: Fix crash on load in DACA sound driver Benjamin Herrenschmidt
@ 2004-03-02 23:17 ` Wojciech 'Sas' Cieciwa
  2004-03-02 22:35   ` Linus Torvalds
  0 siblings, 1 reply; 4+ messages in thread
From: Wojciech 'Sas' Cieciwa @ 2004-03-02 23:17 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, Linus Torvalds


in file drivers/macintosh/macserial.c are two undeclared variable named 
"cmd" 

based on 2.6.4-rc1+cset-20040302_0821.
fixed by this patch.

--- linux-2.6.4-rc1/drivers/macintosh/macserial.c.org	2004-02-27 23:21:29.000000000 +0100
+++ linux-2.6.4-rc1/drivers/macintosh/macserial.c	2004-03-02 21:49:44.533392464 +0100
@@ -1781,6 +1781,7 @@
 {
 	struct mac_serial * info = (struct mac_serial *)tty->driver_data;
 	unsigned char control, status;
+	unsigned int cmd;
 	unsigned long flags;
 
 #ifdef CONFIG_KGDB
@@ -1811,6 +1812,7 @@
 {
 	struct mac_serial * info = (struct mac_serial *)tty->driver_data;
 	unsigned int arg, bits;
+	unsigned int cmd; 
 	unsigned long flags;
 
 #ifdef CONFIG_KGDB


-- 
{Wojciech 'Sas' Cieciwa}  {Member of PLD Team                               }
{e-mail: cieciwa@alpha.zarz.agh.edu.pl, http://www2.zarz.agh.edu.pl/~cieciwa}

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

end of thread, other threads:[~2004-03-02 23:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-02 21:30 [PATCH] ppc32: Fix crash on load in DACA sound driver Benjamin Herrenschmidt
2004-03-02 23:17 ` [PATCH] ppc32: macserial.c missing variable declaration Wojciech 'Sas' Cieciwa
2004-03-02 22:35   ` Linus Torvalds
2004-03-02 22:53     ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®