2021-05-23 15:12:51

by Nizam Haider

[permalink] [raw]
Subject: [PATCH 1/2] char: pcmcia: scr24x_cs: Fix failure handling Handled failure cases of pcmcia_enable_device() and device_create()

From: Nijam Haider <[email protected]>

Signed-off-by: Nijam Haider <[email protected]>
---
drivers/char/pcmcia/scr24x_cs.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/char/pcmcia/scr24x_cs.c b/drivers/char/pcmcia/scr24x_cs.c
index 47feb39..cad1990 100644
--- a/drivers/char/pcmcia/scr24x_cs.c
+++ b/drivers/char/pcmcia/scr24x_cs.c
@@ -233,6 +233,7 @@ static int scr24x_probe(struct pcmcia_device *link)
{
struct scr24x_dev *dev;
int ret;
+ struct device *dev_ret;

dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (!dev)
@@ -272,12 +273,20 @@ static int scr24x_probe(struct pcmcia_device *link)

ret = pcmcia_enable_device(link);
if (ret < 0) {
+ cdev_del(&dev->c_dev);
pcmcia_disable_device(link);
goto err;
}

- device_create(scr24x_class, NULL, MKDEV(MAJOR(scr24x_devt), dev->devno),
+ dev_ret = device_create(scr24x_class, NULL, MKDEV(MAJOR(scr24x_devt), dev->devno),
NULL, "scr24x%d", dev->devno);
+ if (IS_ERR(dev_ret)) {
+ printk(KERN_ERR "device_create failed for %d\n",
+ dev->devno);
+ cdev_del(&dev->c_dev);
+ pcmcia_disable_device(link);
+ goto err;
+ }

dev_info(&link->dev, "SCR24x Chip Card Interface\n");
return 0;
--
2.7.4


2021-05-23 15:13:48

by Nizam Haider

[permalink] [raw]
Subject: [PATCH 2/2] char: pcmcia: scr24x_cs: Fix redundant fops Removed redundant fops assignment, which was already done in cdev_init()

From: Nijam Haider <[email protected]>

Signed-off-by: Nijam Haider <[email protected]>
---
drivers/char/pcmcia/scr24x_cs.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/char/pcmcia/scr24x_cs.c b/drivers/char/pcmcia/scr24x_cs.c
index cad1990..0265d72 100644
--- a/drivers/char/pcmcia/scr24x_cs.c
+++ b/drivers/char/pcmcia/scr24x_cs.c
@@ -266,7 +266,6 @@ static int scr24x_probe(struct pcmcia_device *link)

cdev_init(&dev->c_dev, &scr24x_fops);
dev->c_dev.owner = THIS_MODULE;
- dev->c_dev.ops = &scr24x_fops;
ret = cdev_add(&dev->c_dev, MKDEV(MAJOR(scr24x_devt), dev->devno), 1);
if (ret < 0)
goto err;
--
2.7.4

2021-05-24 07:06:22

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 1/2] char: pcmcia: scr24x_cs: Fix failure handling Handled failure cases of pcmcia_enable_device() and device_create()

On Sun, May 23, 2021 at 08:41:10PM +0530, [email protected] wrote:
> From: Nijam Haider <[email protected]>
>
> Signed-off-by: Nijam Haider <[email protected]>

I can not take patches without any changelog text :(

2021-05-24 07:06:28

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 2/2] char: pcmcia: scr24x_cs: Fix redundant fops Removed redundant fops assignment, which was already done in cdev_init()

On Sun, May 23, 2021 at 08:41:11PM +0530, [email protected] wrote:
> From: Nijam Haider <[email protected]>
>
> Signed-off-by: Nijam Haider <[email protected]>
> ---
> drivers/char/pcmcia/scr24x_cs.c | 1 -
> 1 file changed, 1 deletion(-)

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- You did not specify a description of why the patch is needed, or
possibly, any description at all, in the email body. Please read the
section entitled "The canonical patch format" in the kernel file,
Documentation/SubmittingPatches for what is needed in order to
properly describe the change.

- You did not write a descriptive Subject: for the patch, allowing Greg,
and everyone else, to know what this patch is all about. Please read
the section entitled "The canonical patch format" in the kernel file,
Documentation/SubmittingPatches for what a proper Subject: line should
look like.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

2021-05-24 07:20:10

by Lubomir Rintel

[permalink] [raw]
Subject: Re: [PATCH 2/2] char: pcmcia: scr24x_cs: Fix redundant fops Removed redundant fops assignment, which was already done in cdev_init()

On Sun, May 23, 2021 at 08:41:11PM +0530, [email protected] wrote:
> From: Nijam Haider <[email protected]>
>

Thank you for this. Needs another spin though:

> Subject: [PATCH 2/2] char: pcmcia: scr24x_cs: Fix redundant fops Removed
^
It seems like you accidentally removed a line break here ---------|,
squishing the subject and patch description together.

> redundant fops assignment, which was already done in cdev_init()

Regards,
Lubo

> Signed-off-by: Nijam Haider <[email protected]>
> ---
> drivers/char/pcmcia/scr24x_cs.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/char/pcmcia/scr24x_cs.c b/drivers/char/pcmcia/scr24x_cs.c
> index cad1990..0265d72 100644
> --- a/drivers/char/pcmcia/scr24x_cs.c
> +++ b/drivers/char/pcmcia/scr24x_cs.c
> @@ -266,7 +266,6 @@ static int scr24x_probe(struct pcmcia_device *link)
>
> cdev_init(&dev->c_dev, &scr24x_fops);
> dev->c_dev.owner = THIS_MODULE;
> - dev->c_dev.ops = &scr24x_fops;
> ret = cdev_add(&dev->c_dev, MKDEV(MAJOR(scr24x_devt), dev->devno), 1);
> if (ret < 0)
> goto err;
> --
> 2.7.4
>

2021-05-24 07:24:35

by Lubomir Rintel

[permalink] [raw]
Subject: Re: [PATCH 1/2] char: pcmcia: scr24x_cs: Fix failure handling Handled failure cases of pcmcia_enable_device() and device_create()

> Subject: Re: [PATCH 1/2] char: pcmcia: scr24x_cs: Fix failure handling
> Handled failure cases of pcmcia_enable_device() and device_create()

Here you also manaded to squish the subject line and the patch
description together. Please break them into two.

On Sun, May 23, 2021 at 08:41:10PM +0530, [email protected] wrote:
> From: Nijam Haider <[email protected]>
>
> Signed-off-by: Nijam Haider <[email protected]>
> ---
> drivers/char/pcmcia/scr24x_cs.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/char/pcmcia/scr24x_cs.c b/drivers/char/pcmcia/scr24x_cs.c
> index 47feb39..cad1990 100644
> --- a/drivers/char/pcmcia/scr24x_cs.c
> +++ b/drivers/char/pcmcia/scr24x_cs.c
> @@ -233,6 +233,7 @@ static int scr24x_probe(struct pcmcia_device *link)
> {
> struct scr24x_dev *dev;
> int ret;
> + struct device *dev_ret;

Looks like a whitespace error here?

> dev = kzalloc(sizeof(*dev), GFP_KERNEL);
> if (!dev)
> @@ -272,12 +273,20 @@ static int scr24x_probe(struct pcmcia_device *link)
>
> ret = pcmcia_enable_device(link);
> if (ret < 0) {
> + cdev_del(&dev->c_dev);

Also here? (a tab followed by spaces).

> pcmcia_disable_device(link);
> goto err;
> }
>
> - device_create(scr24x_class, NULL, MKDEV(MAJOR(scr24x_devt), dev->devno),
> + dev_ret = device_create(scr24x_class, NULL, MKDEV(MAJOR(scr24x_devt), dev->devno),
> NULL, "scr24x%d", dev->devno);
> + if (IS_ERR(dev_ret)) {
> + printk(KERN_ERR "device_create failed for %d\n",
> + dev->devno);
> + cdev_del(&dev->c_dev);
> + pcmcia_disable_device(link);
> + goto err;
> + }

...and also here.

In general, please try keeping the formatting consistent with the rest of
the file. Indentation is generally done with tabs.

> dev_info(&link->dev, "SCR24x Chip Card Interface\n");
> return 0;

Thank you,
Lubo