Staging: replace pr_err with dev_err
Subsystems (4)
cover Staging: replace pr_err with dev_err
This patchset replace pr_err with dev_err, when appropriate device structure is found. Issues found using the following Coccinelle script:
@r exists@
identifier f, s, i;
position p;
@@
f(...,struct s *i,...) {
<+...
when != i == NULL
pr_err@p(...);
...+>
}
@rr@
identifier r.s, fld;
@@
struct s {
...
struct device *fld;
...
};@@
identifier r.i, rr.fld;
position r.p;
@@
-pr_err@p
+dev_err
(
+ i->fld,
...)
Haneen Mohammed (4):
Staging: comedi: replace pr_err with dev_err
Staging: gdm724x: replace pr_err with dev_err
Staging: iio: replace pr_err with dev_err
Staging: ft1000: replace pr_err with dev_err
drivers/staging/comedi/comedi_fops.c | 6 ++++-- drivers/staging/ft1000/ft1000-usb/ft1000_usb.c | 5 +++-- drivers/staging/gdm724x/gdm_mux.c | 4 ++-- drivers/staging/gdm724x/gdm_usb.c | 8 ++++---- drivers/staging/iio/resolver/ad2s1210.c | 12 +++++++----- 5 files changed, 20 insertions(+), 15 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/4 Staging: comedi: replace pr_err with dev_err
This patch replace pr_err with dev_err, when appropriate device structure is found.
Issue found using the following Coccinelle script:
@r exists@
identifier f, s, i;
position p;
@@
f(...,struct s *i,...) {
<+...
when != i == NULL
pr_err@p(...);
...+>
}
@rr@
identifier r.s, fld;
@@
struct s {
...
struct device *fld;
...
};@@
identifier r.i, rr.fld;
position r.p;
@@
-pr_err@p
+dev_err
(
+ i->fld,
...)
--- drivers/staging/comedi/comedi_fops.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/comedi/comedi_fops.c +4 -2
@@ -2700,7 +2700,8 @@ struct comedi_device *comedi_alloc_board_minor(struct device *hardware_device)mutex_unlock (&dev->mutex);comedi_device_cleanup (dev);comedi_dev_put (dev); -pr_err ("ran out of minor numbers for board device files\n" ); +dev_err (hardware_device, +"ran out of minor numbers for board device files\n" );return ERR_PTR (-EBUSY ); } dev->minor = i;
@@ -2753,7 +2754,8 @@ int comedi_alloc_subdevice_minor(struct comedi_subdevice *s) }mutex_unlock (&comedi_subdevice_minor_table_lock);if (i ==COMEDI_NUM_SUBDEVICE_MINORS ) { -pr_err ("ran out of minor numbers for subdevice files\n" ); +dev_err (dev->class_dev, +"ran out of minor numbers for subdevice files\n" );return -EBUSY ; } i +=COMEDI_NUM_BOARD_MINORS ;
Signature · 1 line
1.9.1
PATCH 2/4 Staging: gdm724x: replace pr_err with dev_err
In reply to Haneen MohammedThis patch replace pr_err with dev_err, when appropriate device structre is found.
Issue found using the following Coccinelle script:
@r exists@
identifier f, s, i;
position p;
@@
f(...,struct s *i,...) {
<+...
when != i == NULL
pr_err@p(...);
...+>
}
@rr@
identifier r.s, fld;
@@
struct s {
...
struct device *fld;
...
};@@
identifier r.i, rr.fld;
position r.p;
@@
-pr_err@p
+dev_err
(
+ i->fld,
...)
--- drivers/staging/gdm724x/gdm_mux.c | 4 ++-- drivers/staging/gdm724x/gdm_usb.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/gdm724x/gdm_mux.c +2 -2
@@ -608,7 +608,7 @@ static int gdm_mux_suspend(struct usb_interface *intf, pm_message_t pm_msg) rx = &mux_dev->rx;if (mux_dev->usb_state !=PM_NORMAL ) { -pr_err ("usb suspend - invalid state\n" ); +dev_err (intf->usb_dev,"usb suspend - invalid state\n" );return -1 ; }
@@ -637,7 +637,7 @@ static int gdm_mux_resume(struct usb_interface *intf) mux_dev = tty_dev->priv_dev;if (mux_dev->usb_state !=PM_SUSPEND ) { -pr_err ("usb resume - invalid state\n" ); +dev_err (intf->usb_dev,"usb resume - invalid state\n" );return -1 ; }
drivers/staging/gdm724x/gdm_usb.c +4 -4
@@ -848,7 +848,7 @@ static int gdm_usb_probe(struct usb_interface *intf, udev->usbdev = usbdev; ret =init_usb (udev);if (ret <0 ) { -pr_err ("init_usb func failed\n" ); +dev_err (intf->usb_dev,"init_usb func failed\n" ); goto err_init_usb; } udev->intf = intf;
@@ -867,7 +867,7 @@ static int gdm_usb_probe(struct usb_interface *intf, ret =request_mac_address (udev);if (ret <0 ) { -pr_err ("request Mac address failed\n" ); +dev_err (intf->usb_dev,"request Mac address failed\n" ); goto err_mac_address; }
@@ -928,7 +928,7 @@ static int gdm_usb_suspend(struct usb_interface *intf, pm_message_t pm_msg) udev = phy_dev->priv_dev; rx = &udev->rx;if (udev->usb_state !=PM_NORMAL ) { -pr_err ("usb suspend - invalid state\n" ); +dev_err (intf->usb_dev,"usb suspend - invalid state\n" );return -1 ; }
@@ -961,7 +961,7 @@ static int gdm_usb_resume(struct usb_interface *intf) rx = &udev->rx;if (udev->usb_state !=PM_SUSPEND ) { -pr_err ("usb resume - invalid state\n" ); +dev_err (intf->usb_dev,"usb resume - invalid state\n" );return -1 ; } udev->usb_state =PM_NORMAL ;
Signature · 1 line
1.9.1
PATCH 3/4 Staging: iio: replace pr_err with dev_err
In reply to Haneen MohammedThis patch replace pr_err with dev_err, when appropriate device structre is found.
Issue found using the following Coccinelle script:
@r exists@
identifier f, s, i;
position p;
@@
f(...,struct s *i,...) {
<+...
when != i == NULL
pr_err@p(...);
...+>
}
@rr@
identifier r.s, fld;
@@
struct s {
...
struct device *fld;
...
};@@
identifier r.i, rr.fld;
position r.p;
@@
-pr_err@p
+dev_err
(
+ i->fld,
...)
--- drivers/staging/iio/resolver/ad2s1210.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/staging/iio/resolver/ad2s1210.c +7 -5
@@ -214,7 +214,7 @@ static ssize_t ad2s1210_store_fclkin(struct device *dev,if (ret)return ret;if (fclkin <AD2S1210_MIN_CLKIN || fclkin >AD2S1210_MAX_CLKIN ) { -pr_err ("ad2s1210: fclkin out of range\n" ); +dev_err (dev,"ad2s1210: fclkin out of range\n" );return -EINVAL ; }
@@ -252,7 +252,8 @@ static ssize_t ad2s1210_store_fexcit(struct device *dev,if (ret <0 )return ret;if (fexcit <AD2S1210_MIN_EXCIT || fexcit >AD2S1210_MAX_EXCIT ) { -pr_err ("ad2s1210: excitation frequency out of range\n" ); +dev_err (dev, +"ad2s1210: excitation frequency out of range\n" );return -EINVAL ; }mutex_lock (&st->lock);
@@ -307,7 +308,8 @@ static ssize_t ad2s1210_store_control(struct device *dev, goto error_ret;if (ret &AD2S1210_MSB_IS_HIGH ) { ret = -EIO ; -pr_err ("ad2s1210: write control register fail\n" ); +dev_err (dev, +"ad2s1210: write control register fail\n" ); goto error_ret; } st->resolution
@@ -346,7 +348,7 @@ static ssize_t ad2s1210_store_resolution(struct device *dev, ret =kstrtou8 (buf,10 , &udata);if (ret || udata <10 || udata >16 ) { -pr_err ("ad2s1210: resolution out of range\n" ); +dev_err (dev,"ad2s1210: resolution out of range\n" );return -EINVAL ; }mutex_lock (&st->lock);
@@ -368,7 +370,7 @@ static ssize_t ad2s1210_store_resolution(struct device *dev, data = ret;if (data &AD2S1210_MSB_IS_HIGH ) { ret = -EIO ; -pr_err ("ad2s1210: setting resolution fail\n" ); +dev_err (dev,"ad2s1210: setting resolution fail\n" ); goto error_ret; } st->resolution
Signature · 1 line
1.9.1
Re: [Outreachy kernel] [PATCH 3/4] Staging: iio: replace pr_err with dev_err
Quoted 36 lines · Haneen Mohammed
This patch replace
pr_errwithdev_err, when appropriate device structre is found.
Issue found using the following Coccinelle script:@r exists@
identifier f, s, i;
position p;
@@
f(...,struct s *i,...){
<+...
when != i == NULL
pr_err@p(...);
...+>
}@rr@
identifier r.s, fld;
@@struct s { ... struct device *fld; ... };@@
identifier r.i, rr.fld;
position r.p;
@@(quoted diff) +2
-1-pr_err@p +dev_err ( + i->fld,...)
Quoted 1 line
Signed-off-by Haneen Mohammed <[email protected]>
Hi Haneen,
There are a lot of other pr_err instances in that file that you can convert to dev_err.
E.gad2s1210_update_frequency_control_word
You could use the st->sdev->dev. This applies for your changes below, too.
Quoted 47 lines
--- drivers/staging/iio/resolver/ad2s1210.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)drivers/staging/iio/resolver/ad2s1210.c +6
-4@@ -214,7 +214,7 @@ static ssize_t ad2s1210_store_fclkin(struct device *dev,if (ret)return ret;if (fclkin <AD2S1210_MIN_CLKIN || fclkin >AD2S1210_MAX_CLKIN ) { -pr_err ("ad2s1210: fclkin out of range\n" ); +dev_err (dev,"ad2s1210: fclkin out of range\n" );return -EINVAL ; }@@ -252,7 +252,8 @@ static ssize_t ad2s1210_store_fexcit(struct device *dev,if (ret <0 )return ret;if (fexcit <AD2S1210_MIN_EXCIT || fexcit >AD2S1210_MAX_EXCIT ) { -pr_err ("ad2s1210: excitation frequency out of range\n" ); +dev_err (dev, +"ad2s1210: excitation frequency out of range\n" );return -EINVAL ; }mutex_lock (&st->lock);@@ -307,7 +308,8 @@ static ssize_t ad2s1210_store_control(struct device *dev, goto error_ret;if (ret &AD2S1210_MSB_IS_HIGH ) { ret = -EIO ; -pr_err ("ad2s1210: write control register fail\n" ); +dev_err (dev, +"ad2s1210: write control register fail\n" ); goto error_ret; } st->resolution@@ -346,7 +348,7 @@ static ssize_t ad2s1210_store_resolution(struct device *dev, ret =kstrtou8 (buf,10 , &udata);if (ret || udata <10 || udata >16 ) { -pr_err ("ad2s1210: resolution out of range\n" ); +dev_err (dev,"ad2s1210: resolution out of range\n" );return -EINVAL ; }mutex_lock (&st->lock);
drivers/staging/iio/resolver/ad2s1210.c static ssize_t ad2s1210_store_resolution(struct device *dev, · line 376
Quoted 8 lines
drivers/staging/iio/resolver/ad2s1210.c +1
-1@@ -368,7 +370,7 @@ static ssize_t ad2s1210_store_resolution(struct device *dev, data = ret;if (data &AD2S1210_MSB_IS_HIGH ) { ret = -EIO ; -pr_err ("ad2s1210: setting resolution fail\n" ); +dev_err (dev,"ad2s1210: setting resolution fail\n" ); goto error_ret; } st->resolution
thanks,
Daniel.
Re: [Outreachy kernel] [PATCH 3/4] Staging: iio: replace pr_err with dev_err
Quoted 42 lines · Daniel Baluta
Quoted 36 lines · Haneen Mohammed
This patch replace
pr_errwithdev_err, when appropriate device structre is found.
Issue found using the following Coccinelle script:@r exists@
identifier f, s, i;
position p;
@@
f(...,struct s *i,...){
<+...
when != i == NULL
pr_err@p(...);
...+>
}@rr@
identifier r.s, fld;
@@struct s { ... struct device *fld; ... };@@
identifier r.i, rr.fld;
position r.p;
@@(quoted diff) +2
-1-pr_err@p +dev_err ( + i->fld,...)
Quoted 1 line
Signed-off-by Haneen Mohammed <[email protected]>Hi Haneen,
Quoted 7 lines
There are a lot of other
pr_errinstances in that file that you can convert todev_err.E.g
ad2s1210_update_frequency_control_wordYou could use the
st->sdev->dev. This applies for your changes below, too.
Maybe this is related to the lack of --all-includes.
julia
Quoted 67 lines
Quoted 49 lines
--- drivers/staging/iio/resolver/ad2s1210.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)drivers/staging/iio/resolver/ad2s1210.c +6
-4@@ -214,7 +214,7 @@ static ssize_t ad2s1210_store_fclkin(struct device *dev,if (ret)return ret;if (fclkin <AD2S1210_MIN_CLKIN || fclkin >AD2S1210_MAX_CLKIN ) { -pr_err ("ad2s1210: fclkin out of range\n" ); +dev_err (dev,"ad2s1210: fclkin out of range\n" );return -EINVAL ; }@@ -252,7 +252,8 @@ static ssize_t ad2s1210_store_fexcit(struct device *dev,if (ret <0 )return ret;if (fexcit <AD2S1210_MIN_EXCIT || fexcit >AD2S1210_MAX_EXCIT ) { -pr_err ("ad2s1210: excitation frequency out of range\n" ); +dev_err (dev, +"ad2s1210: excitation frequency out of range\n" );return -EINVAL ; }mutex_lock (&st->lock);@@ -307,7 +308,8 @@ static ssize_t ad2s1210_store_control(struct device *dev, goto error_ret;if (ret &AD2S1210_MSB_IS_HIGH ) { ret = -EIO ; -pr_err ("ad2s1210: write control register fail\n" ); +dev_err (dev, +"ad2s1210: write control register fail\n" ); goto error_ret; } st->resolution@@ -346,7 +348,7 @@ static ssize_t ad2s1210_store_resolution(struct device *dev, ret =kstrtou8 (buf,10 , &udata);if (ret || udata <10 || udata >16 ) { -pr_err ("ad2s1210: resolution out of range\n" ); +dev_err (dev,"ad2s1210: resolution out of range\n" );return -EINVAL ; }mutex_lock (&st->lock);drivers/staging/iio/resolver/ad2s1210.c static ssize_t ad2s1210_store_resolution(struct device *dev, · line 376
Quoted 8 lines
drivers/staging/iio/resolver/ad2s1210.c +1
-1@@ -368,7 +370,7 @@ static ssize_t ad2s1210_store_resolution(struct device *dev, data = ret;if (data &AD2S1210_MSB_IS_HIGH ) { ret = -EIO ; -pr_err ("ad2s1210: setting resolution fail\n" ); +dev_err (dev,"ad2s1210: setting resolution fail\n" ); goto error_ret; } st->resolutionthanks,
Daniel.--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAEnQRZA4fAKcA%3DVh5DRCHfh%3DWjB1HnhySffgkgu%2B6-9Qfu6orA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Re: [Outreachy kernel] [PATCH 3/4] Staging: iio: replace pr_err with dev_err
Quoted 49 lines · Julia Lawall
Quoted 45 lines · Daniel Baluta
Quoted 36 lines · Haneen Mohammed
This patch replace
pr_errwithdev_err, when appropriate device structre is found.
Issue found using the following Coccinelle script:@r exists@
identifier f, s, i;
position p;
@@
f(...,struct s *i,...){
<+...
when != i == NULL
pr_err@p(...);
...+>
}@rr@
identifier r.s, fld;
@@struct s { ... struct device *fld; ... };@@
identifier r.i, rr.fld;
position r.p;
@@(quoted diff) +2
-1-pr_err@p +dev_err ( + i->fld,...)
Quoted 1 line
Signed-off-by Haneen Mohammed <[email protected]>Hi Haneen,
There are a lot of other
pr_errinstances in that file that you can convert todev_err.
Quoted 9 lines
Quoted 4 lines
E.g
ad2s1210_update_frequency_control_wordYou could use the
st->sdev->dev. This applies for your changes below, too.Maybe this is related to the lack of --all-includes.
julia
I did use --all-includes :) this is what I used:
$ spatch --sp-file ../pr3.cocci --all-includes -I include/ --dir drivers/staging/ > ../pr4.out
This was hinted in this video, becuase without it I didn't get any result:
https://www.youtube.com/watch?v=4uhHhKTOHDs
But I think I need to refine the script to include other cases. Also, I needed to manulaly adjust some of the outputs such as when the device struct is what was passed in the function, becuase for that I got the following in comedi/comedi_fops.c:
dev_err(hardware_device->parent,
"ran out of minor numbers for board device
files\n");
And I got two outputs that I couldn't confirm if there were a device struct, such as "dev_err(port->dev," from panel/panel.c file and dev_err(mc_io->dev, from fsl-mc/bus/mc-bus.c
Quoted 67 lines
Quoted 67 lines
Quoted 49 lines
--- drivers/staging/iio/resolver/ad2s1210.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)drivers/staging/iio/resolver/ad2s1210.c +6
-4@@ -214,7 +214,7 @@ static ssize_t ad2s1210_store_fclkin(struct device *dev,if (ret)return ret;if (fclkin <AD2S1210_MIN_CLKIN || fclkin >AD2S1210_MAX_CLKIN ) { -pr_err ("ad2s1210: fclkin out of range\n" ); +dev_err (dev,"ad2s1210: fclkin out of range\n" );return -EINVAL ; }@@ -252,7 +252,8 @@ static ssize_t ad2s1210_store_fexcit(struct device *dev,if (ret <0 )return ret;if (fexcit <AD2S1210_MIN_EXCIT || fexcit >AD2S1210_MAX_EXCIT ) { -pr_err ("ad2s1210: excitation frequency out of range\n" ); +dev_err (dev, +"ad2s1210: excitation frequency out of range\n" );return -EINVAL ; }mutex_lock (&st->lock);@@ -307,7 +308,8 @@ static ssize_t ad2s1210_store_control(struct device *dev, goto error_ret;if (ret &AD2S1210_MSB_IS_HIGH ) { ret = -EIO ; -pr_err ("ad2s1210: write control register fail\n" ); +dev_err (dev, +"ad2s1210: write control register fail\n" ); goto error_ret; } st->resolution@@ -346,7 +348,7 @@ static ssize_t ad2s1210_store_resolution(struct device *dev, ret =kstrtou8 (buf,10 , &udata);if (ret || udata <10 || udata >16 ) { -pr_err ("ad2s1210: resolution out of range\n" ); +dev_err (dev,"ad2s1210: resolution out of range\n" );return -EINVAL ; }mutex_lock (&st->lock);drivers/staging/iio/resolver/ad2s1210.c static ssize_t ad2s1210_store_resolution(struct device *dev, · line 376
Quoted 8 lines
drivers/staging/iio/resolver/ad2s1210.c +1
-1@@ -368,7 +370,7 @@ static ssize_t ad2s1210_store_resolution(struct device *dev, data = ret;if (data &AD2S1210_MSB_IS_HIGH ) { ret = -EIO ; -pr_err ("ad2s1210: setting resolution fail\n" ); +dev_err (dev,"ad2s1210: setting resolution fail\n" ); goto error_ret; } st->resolutionthanks,
Daniel.--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAEnQRZA4fAKcA%3DVh5DRCHfh%3DWjB1HnhySffgkgu%2B6-9Qfu6orA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Re: [Outreachy kernel] [PATCH 3/4] Staging: iio: replace pr_err with dev_err
Quoted 53 lines · Haneen
Quoted 52 lines · Julia Lawall
Quoted 48 lines · Daniel Baluta
Quoted 36 lines · Haneen Mohammed
This patch replace
pr_errwithdev_err, when appropriate device structre is found.
Issue found using the following Coccinelle script:@r exists@
identifier f, s, i;
position p;
@@
f(...,struct s *i,...){
<+...
when != i == NULL
pr_err@p(...);
...+>
}@rr@
identifier r.s, fld;
@@struct s { ... struct device *fld; ... };@@
identifier r.i, rr.fld;
position r.p;
@@(quoted diff) +2
-1-pr_err@p +dev_err ( + i->fld,...)
Quoted 1 line
Signed-off-by Haneen Mohammed <[email protected]>Hi Haneen,
There are a lot of other
pr_errinstances in that file that you can convert todev_err.E.g
ad2s1210_update_frequency_control_word
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
You could use the
st->sdev->dev. This applies for your changes below, too.Maybe this is related to the lack of --all-includes.
julia
I did use --all-includes :) this is what I used:
OK, you can try replacing --all-includes with --recursive-includes. That will include header files that are included by other header files. It could be slow, though.
In thinking about it, I think that you are right that you should include more patterns. For your parameter, you have a type, so you need to look in it for a device strcuture, but if you don't find it, you may want to look in all other structure typed fields to see if their types have device structures.
julia
Quoted 95 lines
$ spatch --sp-file ../pr3.cocci --all-includes -I include/ --dir drivers/staging/ > ../pr4.outThis was hinted in this video, becuase without it I didn't get any result:
https://www.youtube.com/watch?v=4uhHhKTOHDsBut I think I need to refine the script to include other cases. Also, I needed to manulaly adjust some of the outputs such as when the device struct is what was passed in the function, becuase for that I got the following in
comedi/comedi_fops.c:
dev_err(hardware_device->parent,
"ran out of minor numbers for board device
files\n");And I got two outputs that I couldn't confirm if there were a device struct, such as "dev_err(port->dev," from
panel/panel.cfile and dev_err(mc_io->dev, fromfsl-mc/bus/mc-bus.cQuoted 60 lines
Quoted 60 lines
Quoted 49 lines
--- drivers/staging/iio/resolver/ad2s1210.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)drivers/staging/iio/resolver/ad2s1210.c +6
-4@@ -214,7 +214,7 @@ static ssize_t ad2s1210_store_fclkin(struct device *dev,if (ret)return ret;if (fclkin <AD2S1210_MIN_CLKIN || fclkin >AD2S1210_MAX_CLKIN ) { -pr_err ("ad2s1210: fclkin out of range\n" ); +dev_err (dev,"ad2s1210: fclkin out of range\n" );return -EINVAL ; }@@ -252,7 +252,8 @@ static ssize_t ad2s1210_store_fexcit(struct device *dev,if (ret <0 )return ret;if (fexcit <AD2S1210_MIN_EXCIT || fexcit >AD2S1210_MAX_EXCIT ) { -pr_err ("ad2s1210: excitation frequency out of range\n" ); +dev_err (dev, +"ad2s1210: excitation frequency out of range\n" );return -EINVAL ; }mutex_lock (&st->lock);@@ -307,7 +308,8 @@ static ssize_t ad2s1210_store_control(struct device *dev, goto error_ret;if (ret &AD2S1210_MSB_IS_HIGH ) { ret = -EIO ; -pr_err ("ad2s1210: write control register fail\n" ); +dev_err (dev, +"ad2s1210: write control register fail\n" ); goto error_ret; } st->resolution@@ -346,7 +348,7 @@ static ssize_t ad2s1210_store_resolution(struct device *dev, ret =kstrtou8 (buf,10 , &udata);if (ret || udata <10 || udata >16 ) { -pr_err ("ad2s1210: resolution out of range\n" ); +dev_err (dev,"ad2s1210: resolution out of range\n" );return -EINVAL ; }mutex_lock (&st->lock);drivers/staging/iio/resolver/ad2s1210.c static ssize_t ad2s1210_store_resolution(struct device *dev, · line 376
Quoted 8 lines
drivers/staging/iio/resolver/ad2s1210.c +1
-1@@ -368,7 +370,7 @@ static ssize_t ad2s1210_store_resolution(struct device *dev, data = ret;if (data &AD2S1210_MSB_IS_HIGH ) { ret = -EIO ; -pr_err ("ad2s1210: setting resolution fail\n" ); +dev_err (dev,"ad2s1210: setting resolution fail\n" ); goto error_ret; } st->resolutionthanks,
Daniel.Quoted 7 lines
Quoted 7 lines
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAEnQRZA4fAKcA%3DVh5DRCHfh%3DWjB1HnhySffgkgu%2B6-9Qfu6orA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20150317111042.GA24753%40haneen-vb.
For more options, visit https://groups.google.com/d/optout.
PATCH 4/4 Staging: ft1000: replace pr_err with dev_err
In reply to Haneen MohammedThis patch replace pr_err with dev_err, when appropriate device structure is found.
Issue found using the following Coccinelle script:
@r exists@
identifier f, s, i;
position p;
@@
f(...,struct s *i,...) {
<+...
when != i == NULL
pr_err@p(...);
...+>
}
@rr@
identifier r.s, fld;
@@
struct s {
...
struct device *fld;
...
};@@
identifier r.i, rr.fld;
position r.p;
@@
-pr_err@p
+dev_err
(
+ i->fld,
...)
--- drivers/staging/ft1000/ft1000-usb/ft1000_usb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/ft1000/ft1000-usb/ft1000_usb.c +3 -2
@@ -136,7 +136,7 @@ static int ft1000_probe(struct usb_interface *interface, ret =request_firmware (&dsp_fw,"ft3000.img" , &dev->dev);if (ret <0 ) { -pr_err ("Error request_firmware()\n" ); +dev_err (interface->usb_dev,"Error request_firmware()\n" ); goto err_fw; }
@@ -164,7 +164,8 @@ static int ft1000_probe(struct usb_interface *interface,pr_debug ("pft1000info=%p\n" , pft1000info); ret =dsp_reload (ft1000dev);if (ret) { -pr_err ("Problem with DSP image loading\n" ); +dev_err (interface->usb_dev, +"Problem with DSP image loading\n" ); goto err_load; }
Signature · 1 line
1.9.1
Re: [Outreachy kernel] [PATCH 4/4] Staging: ft1000: replace pr_err with dev_err
Quoted 2 lines · Haneen Mohammed
This patch replace
pr_errwithdev_err, when appropriate device structure is found.
How did you run Coccinelle for this? You may get more results with eg --all-includes, since structure definitions may be in header files.
julia
Quoted 72 lines
Issue found using the following Coccinelle script:
@r exists@
identifier f, s, i;
position p;
@@
f(...,struct s *i,...){
<+...
when != i == NULL
pr_err@p(...);
...+>
}@rr@
identifier r.s, fld;
@@struct s { ... struct device *fld; ... };@@
identifier r.i, rr.fld;
position r.p;
@@(quoted diff) +2
-1-pr_err@p +dev_err ( + i->fld,...)
Signed-off-by Haneen Mohammed <[email protected]>--- drivers/staging/ft1000/ft1000-usb/ft1000_usb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/staging/ft1000/ft1000-usb/ft1000_usb.c +3
-3@@ -136,7 +136,7 @@ static int ft1000_probe(struct usb_interface *interface, ret =request_firmware (&dsp_fw,"ft3000.img" , &dev->dev);if (ret <0 ) { -pr_err ("Error request_firmware()\n" ); +dev_err (interface->usb_dev,"Error request_firmware()\n" ); goto err_fw; }@@ -164,7 +164,8 @@ static int ft1000_probe(struct usb_interface *interface,pr_debug ("pft1000info=%p\n" , pft1000info); ret =dsp_reload (ft1000dev);if (ret) { -pr_err ("Problem with DSP image loading\n" ); +dev_err (interface->usb_dev, +"Problem with DSP image loading\n" ); goto err_load; } --1.9.1
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1426570656-22498-1-git-send-email-hamohammed.sa%40gmail.com.
For more options, visit https://groups.google.com/d/optout.