2023-03-17 06:48:24

by Yu Zhe

[permalink] [raw]
Subject: [PATCH] mmc: core: remove unnecessary (void*) conversions

Pointer variables of void * type do not require type cast.

Signed-off-by: Yu Zhe <[email protected]>
---
drivers/mmc/core/debugfs.c | 2 +-
drivers/mmc/core/host.c | 2 +-
drivers/mmc/core/mmc_test.c | 6 +++---
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
index fe6808771bc7..2c97b94aab23 100644
--- a/drivers/mmc/core/debugfs.c
+++ b/drivers/mmc/core/debugfs.c
@@ -246,7 +246,7 @@ DEFINE_DEBUGFS_ATTRIBUTE(mmc_err_state, mmc_err_state_get, NULL, "%llu\n");

static int mmc_err_stats_show(struct seq_file *file, void *data)
{
- struct mmc_host *host = (struct mmc_host *)file->private;
+ struct mmc_host *host = file->private;
const char *desc[MMC_ERR_MAX] = {
[MMC_ERR_CMD_TIMEOUT] = "Command Timeout Occurred",
[MMC_ERR_CMD_CRC] = "Command CRC Errors Occurred",
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 096093f7be00..76900f67c782 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -590,7 +590,7 @@ EXPORT_SYMBOL(mmc_alloc_host);

static void devm_mmc_host_release(struct device *dev, void *res)
{
- mmc_free_host(*(struct mmc_host **)res);
+ mmc_free_host(res);
}

struct mmc_host *devm_mmc_alloc_host(struct device *dev, int extra)
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index 156d34b2ed4d..0f6a563103fd 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -3045,7 +3045,7 @@ static LIST_HEAD(mmc_test_file_test);

static int mtf_test_show(struct seq_file *sf, void *data)
{
- struct mmc_card *card = (struct mmc_card *)sf->private;
+ struct mmc_card *card = sf->private;
struct mmc_test_general_result *gr;

mutex_lock(&mmc_test_lock);
@@ -3079,8 +3079,8 @@ static int mtf_test_open(struct inode *inode, struct file *file)
static ssize_t mtf_test_write(struct file *file, const char __user *buf,
size_t count, loff_t *pos)
{
- struct seq_file *sf = (struct seq_file *)file->private_data;
- struct mmc_card *card = (struct mmc_card *)sf->private;
+ struct seq_file *sf = file->private_data;
+ struct mmc_card *card = sf->private;
struct mmc_test_card *test;
long testcase;
int ret;
--
2.11.0



2023-03-23 12:17:16

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH] mmc: core: remove unnecessary (void*) conversions

On Fri, 17 Mar 2023 at 07:48, Yu Zhe <[email protected]> wrote:
>
> Pointer variables of void * type do not require type cast.
>
> Signed-off-by: Yu Zhe <[email protected]>

Applied for next, thanks!

Kind regards
Uffe


> ---
> drivers/mmc/core/debugfs.c | 2 +-
> drivers/mmc/core/host.c | 2 +-
> drivers/mmc/core/mmc_test.c | 6 +++---
> 3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
> index fe6808771bc7..2c97b94aab23 100644
> --- a/drivers/mmc/core/debugfs.c
> +++ b/drivers/mmc/core/debugfs.c
> @@ -246,7 +246,7 @@ DEFINE_DEBUGFS_ATTRIBUTE(mmc_err_state, mmc_err_state_get, NULL, "%llu\n");
>
> static int mmc_err_stats_show(struct seq_file *file, void *data)
> {
> - struct mmc_host *host = (struct mmc_host *)file->private;
> + struct mmc_host *host = file->private;
> const char *desc[MMC_ERR_MAX] = {
> [MMC_ERR_CMD_TIMEOUT] = "Command Timeout Occurred",
> [MMC_ERR_CMD_CRC] = "Command CRC Errors Occurred",
> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> index 096093f7be00..76900f67c782 100644
> --- a/drivers/mmc/core/host.c
> +++ b/drivers/mmc/core/host.c
> @@ -590,7 +590,7 @@ EXPORT_SYMBOL(mmc_alloc_host);
>
> static void devm_mmc_host_release(struct device *dev, void *res)
> {
> - mmc_free_host(*(struct mmc_host **)res);
> + mmc_free_host(res);
> }
>
> struct mmc_host *devm_mmc_alloc_host(struct device *dev, int extra)
> diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
> index 156d34b2ed4d..0f6a563103fd 100644
> --- a/drivers/mmc/core/mmc_test.c
> +++ b/drivers/mmc/core/mmc_test.c
> @@ -3045,7 +3045,7 @@ static LIST_HEAD(mmc_test_file_test);
>
> static int mtf_test_show(struct seq_file *sf, void *data)
> {
> - struct mmc_card *card = (struct mmc_card *)sf->private;
> + struct mmc_card *card = sf->private;
> struct mmc_test_general_result *gr;
>
> mutex_lock(&mmc_test_lock);
> @@ -3079,8 +3079,8 @@ static int mtf_test_open(struct inode *inode, struct file *file)
> static ssize_t mtf_test_write(struct file *file, const char __user *buf,
> size_t count, loff_t *pos)
> {
> - struct seq_file *sf = (struct seq_file *)file->private_data;
> - struct mmc_card *card = (struct mmc_card *)sf->private;
> + struct seq_file *sf = file->private_data;
> + struct mmc_card *card = sf->private;
> struct mmc_test_card *test;
> long testcase;
> int ret;
> --
> 2.11.0
>

2023-03-24 13:33:45

by Marek Szyprowski

[permalink] [raw]
Subject: Re: [PATCH] mmc: core: remove unnecessary (void*) conversions

On 17.03.2023 07:47, Yu Zhe wrote:
> Pointer variables of void * type do not require type cast.
>
> Signed-off-by: Yu Zhe <[email protected]>
> ---
> drivers/mmc/core/debugfs.c | 2 +-
> drivers/mmc/core/host.c | 2 +-
> drivers/mmc/core/mmc_test.c | 6 +++---
> 3 files changed, 5 insertions(+), 5 deletions(-)
...
> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> index 096093f7be00..76900f67c782 100644
> --- a/drivers/mmc/core/host.c
> +++ b/drivers/mmc/core/host.c
> @@ -590,7 +590,7 @@ EXPORT_SYMBOL(mmc_alloc_host);
>
> static void devm_mmc_host_release(struct device *dev, void *res)
> {
> - mmc_free_host(*(struct mmc_host **)res);
> + mmc_free_host(res);

The above chunk is wrong and causes following regression on today's
Linux next-20230324:

Unable to handle kernel paging request at virtual address 0000000000001020
Mem abort info:
meson-gx-mmc ffe07000.mmc: allocated mmc-pwrseq
...
[0000000000001020] user address but active_mm is swapper
Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
Modules linked in:
CPU: 3 PID: 10 Comm: kworker/u12:0 Not tainted 6.3.0-rc3-next-20230324+
#13452
Hardware name: Khadas VIM3 (DT)
Workqueue: events_unbound async_run_entry_fn
pstate: 00000005 (nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : mmc_pwrseq_free+0x1c/0x38
lr : devm_mmc_host_release+0x1c/0x34
...
Call trace:
 mmc_pwrseq_free+0x1c/0x38
 devm_mmc_host_release+0x1c/0x34
 release_nodes+0x5c/0x90
 devres_release_all+0x8c/0xdc
 device_unbind_cleanup+0x18/0x68
 really_probe+0x11c/0x2b4
 __driver_probe_device+0x78/0xe0
 driver_probe_device+0xd8/0x160
 __device_attach_driver+0xb8/0x138
 bus_for_each_drv+0x84/0xe0
 __device_attach_async_helper+0xb0/0xd4
 async_run_entry_fn+0x34/0xe0
 process_one_work+0x288/0x5c0
 worker_thread+0x74/0x450
 kthread+0x124/0x128
 ret_from_fork+0x10/0x20
Code: f9000bf3 aa0003f3 f9424c00 b4000080 (f9401000)
---[ end trace 0000000000000000 ]---

Ulf: do You want me to send a partial revert or will you handle it by
dropping this patch?

Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland

2023-03-24 15:48:44

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH] mmc: core: remove unnecessary (void*) conversions

On Fri, 24 Mar 2023 at 14:28, Marek Szyprowski <[email protected]> wrote:
>
> On 17.03.2023 07:47, Yu Zhe wrote:
> > Pointer variables of void * type do not require type cast.
> >
> > Signed-off-by: Yu Zhe <[email protected]>
> > ---
> > drivers/mmc/core/debugfs.c | 2 +-
> > drivers/mmc/core/host.c | 2 +-
> > drivers/mmc/core/mmc_test.c | 6 +++---
> > 3 files changed, 5 insertions(+), 5 deletions(-)
> ...
> > diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> > index 096093f7be00..76900f67c782 100644
> > --- a/drivers/mmc/core/host.c
> > +++ b/drivers/mmc/core/host.c
> > @@ -590,7 +590,7 @@ EXPORT_SYMBOL(mmc_alloc_host);
> >
> > static void devm_mmc_host_release(struct device *dev, void *res)
> > {
> > - mmc_free_host(*(struct mmc_host **)res);
> > + mmc_free_host(res);
>
> The above chunk is wrong and causes following regression on today's
> Linux next-20230324:
>
> Unable to handle kernel paging request at virtual address 0000000000001020
> Mem abort info:
> meson-gx-mmc ffe07000.mmc: allocated mmc-pwrseq
> ...
> [0000000000001020] user address but active_mm is swapper
> Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
> Modules linked in:
> CPU: 3 PID: 10 Comm: kworker/u12:0 Not tainted 6.3.0-rc3-next-20230324+
> #13452
> Hardware name: Khadas VIM3 (DT)
> Workqueue: events_unbound async_run_entry_fn
> pstate: 00000005 (nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> pc : mmc_pwrseq_free+0x1c/0x38
> lr : devm_mmc_host_release+0x1c/0x34
> ...
> Call trace:
> mmc_pwrseq_free+0x1c/0x38
> devm_mmc_host_release+0x1c/0x34
> release_nodes+0x5c/0x90
> devres_release_all+0x8c/0xdc
> device_unbind_cleanup+0x18/0x68
> really_probe+0x11c/0x2b4
> __driver_probe_device+0x78/0xe0
> driver_probe_device+0xd8/0x160
> __device_attach_driver+0xb8/0x138
> bus_for_each_drv+0x84/0xe0
> __device_attach_async_helper+0xb0/0xd4
> async_run_entry_fn+0x34/0xe0
> process_one_work+0x288/0x5c0
> worker_thread+0x74/0x450
> kthread+0x124/0x128
> ret_from_fork+0x10/0x20
> Code: f9000bf3 aa0003f3 f9424c00 b4000080 (f9401000)
> ---[ end trace 0000000000000000 ]---
>
> Ulf: do You want me to send a partial revert or will you handle it by
> dropping this patch?

Thanks for the report, I will simply drop the patch!

Kind regards
Uffe

2023-03-24 16:50:23

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] mmc: core: remove unnecessary (void*) conversions

On Fri, Mar 24, 2023 at 02:28:57PM +0100, Marek Szyprowski wrote:
> On 17.03.2023 07:47, Yu Zhe wrote:
> > Pointer variables of void * type do not require type cast.
> >
> > Signed-off-by: Yu Zhe <[email protected]>
> > ---
> > drivers/mmc/core/debugfs.c | 2 +-
> > drivers/mmc/core/host.c | 2 +-
> > drivers/mmc/core/mmc_test.c | 6 +++---
> > 3 files changed, 5 insertions(+), 5 deletions(-)
> ...
> > diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> > index 096093f7be00..76900f67c782 100644
> > --- a/drivers/mmc/core/host.c
> > +++ b/drivers/mmc/core/host.c
> > @@ -590,7 +590,7 @@ EXPORT_SYMBOL(mmc_alloc_host);
> >
> > static void devm_mmc_host_release(struct device *dev, void *res)
> > {
> > - mmc_free_host(*(struct mmc_host **)res);
> > + mmc_free_host(res);
>
> The above chunk is wrong and causes following regression on today's
> Linux next-20230324:

Ugh...

Ok. I have a script that I use to help review mechanical patches. I
have added an '-r cast' option to help review "remove unnecessary cast"
patches.

If you do `cat this_email.txt | rename_rev.pl -r cast` then the output
looks like:

================
static void devm_mmc_host_release(struct device *dev, void *res)
{
- mmc_free_host(*res);
+ mmc_free_host(res);
}

struct mmc_host *devm_mmc_alloc_host(struct device *dev, int extra)
================

I have gone through all of Yu Zhe's patches and the rest are okay.

I've attached my rename_rev.pl script.

regards,
dan carpenter


Attachments:
(No filename) (1.53 kB)
rename_rev.pl (11.47 kB)
Download all attachments

2023-03-27 02:10:46

by Yu Zhe

[permalink] [raw]
Subject: Re: Re: [PATCH] mmc: core: remove unnecessary (void*) conversions

<p><br /><br /><br />在 2023-03-24, 星期五, 23:47:08 ,Ulf Hansson 写到:</p>
<pre>On Fri, 24 Mar 2023 at 14:28, Marek Szyprowski <[email protected]> wrote:
>
> On 17.03.2023 07:47, Yu Zhe wrote:
> > Pointer variables of void * type do not require type cast.
> >
> > Signed-off-by: Yu Zhe <[email protected]>
> > ---
> > drivers/mmc/core/debugfs.c | 2 +-
> > drivers/mmc/core/host.c | 2 +-
> > drivers/mmc/core/mmc_test.c | 6 +++---
> > 3 files changed, 5 insertions(+), 5 deletions(-)
> ...
> > diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> > index 096093f7be00..76900f67c782 100644
> > --- a/drivers/mmc/core/host.c
> > +++ b/drivers/mmc/core/host.c
> > @@ -590,7 +590,7 @@ EXPORT_SYMBOL(mmc_alloc_host);
> >
> > static void devm_mmc_host_release(struct device *dev, void *res)
> > {
> > - mmc_free_host(*(struct mmc_host **)res);
> > + mmc_free_host(res);
>
> The above chunk is wrong and causes following regression on today's
> Linux next-20230324:
>
> Unable to handle kernel paging request at virtual address 0000000000001020
> Mem abort info:
> meson-gx-mmc ffe07000.mmc: allocated mmc-pwrseq
> ...
> [0000000000001020] user address but active_mm is swapper
> Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
> Modules linked in:
> CPU: 3 PID: 10 Comm: kworker/u12:0 Not tainted 6.3.0-rc3-next-20230324+
> #13452
> Hardware name: Khadas VIM3 (DT)
> Workqueue: events_unbound async_run_entry_fn
> pstate: 00000005 (nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> pc : mmc_pwrseq_free+0x1c/0x38
> lr : devm_mmc_host_release+0x1c/0x34
> ...
> Call trace:
> mmc_pwrseq_free+0x1c/0x38
> devm_mmc_host_release+0x1c/0x34
> release_nodes+0x5c/0x90
> devres_release_all+0x8c/0xdc
> device_unbind_cleanup+0x18/0x68
> really_probe+0x11c/0x2b4
> __driver_probe_device+0x78/0xe0
> driver_probe_device+0xd8/0x160
> __device_attach_driver+0xb8/0x138
> bus_for_each_drv+0x84/0xe0
> __device_attach_async_helper+0xb0/0xd4
> async_run_entry_fn+0x34/0xe0
> process_one_work+0x288/0x5c0
> worker_thread+0x74/0x450
> kthread+0x124/0x128
> ret_from_fork+0x10/0x20
> Code: f9000bf3 aa0003f3 f9424c00 b4000080 (f9401000)
> ---[ end trace 0000000000000000 ]---
>
> Ulf: do You want me to send a partial revert or will you handle it by
> dropping this patch?

Thanks for the report, I will simply drop the patch!

Kind regards
Uffe
</pre>

sorry for making this mistake, I will check seriously next time.

2023-03-27 10:29:11

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH] mmc: core: remove unnecessary (void*) conversions

On Fri, 24 Mar 2023 at 17:39, Dan Carpenter <[email protected]> wrote:
>
> On Fri, Mar 24, 2023 at 02:28:57PM +0100, Marek Szyprowski wrote:
> > On 17.03.2023 07:47, Yu Zhe wrote:
> > > Pointer variables of void * type do not require type cast.
> > >
> > > Signed-off-by: Yu Zhe <[email protected]>
> > > ---
> > > drivers/mmc/core/debugfs.c | 2 +-
> > > drivers/mmc/core/host.c | 2 +-
> > > drivers/mmc/core/mmc_test.c | 6 +++---
> > > 3 files changed, 5 insertions(+), 5 deletions(-)
> > ...
> > > diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> > > index 096093f7be00..76900f67c782 100644
> > > --- a/drivers/mmc/core/host.c
> > > +++ b/drivers/mmc/core/host.c
> > > @@ -590,7 +590,7 @@ EXPORT_SYMBOL(mmc_alloc_host);
> > >
> > > static void devm_mmc_host_release(struct device *dev, void *res)
> > > {
> > > - mmc_free_host(*(struct mmc_host **)res);
> > > + mmc_free_host(res);
> >
> > The above chunk is wrong and causes following regression on today's
> > Linux next-20230324:
>
> Ugh...
>
> Ok. I have a script that I use to help review mechanical patches. I
> have added an '-r cast' option to help review "remove unnecessary cast"
> patches.
>
> If you do `cat this_email.txt | rename_rev.pl -r cast` then the output
> looks like:
>
> ================
> static void devm_mmc_host_release(struct device *dev, void *res)
> {
> - mmc_free_host(*res);
> + mmc_free_host(res);
> }
>
> struct mmc_host *devm_mmc_alloc_host(struct device *dev, int extra)
> ================
>
> I have gone through all of Yu Zhe's patches and the rest are okay.
>
> I've attached my rename_rev.pl script.

Thanks for helping out Dan! I will use your script next time!

Kind regards
Uffe

2023-03-27 10:31:24

by Ulf Hansson

[permalink] [raw]
Subject: Re: Re: [PATCH] mmc: core: remove unnecessary (void*) conversions

On Mon, 27 Mar 2023 at 04:07, yuzhe <[email protected]> wrote:
>
> <p><br /><br /><br />在 2023-03-24, 星期五, 23:47:08 ,Ulf Hansson 写到:</p>
> <pre>On Fri, 24 Mar 2023 at 14:28, Marek Szyprowski <[email protected]> wrote:
> >
> > On 17.03.2023 07:47, Yu Zhe wrote:
> > > Pointer variables of void * type do not require type cast.
> > >
> > > Signed-off-by: Yu Zhe <[email protected]>
> > > ---
> > > drivers/mmc/core/debugfs.c | 2 +-
> > > drivers/mmc/core/host.c | 2 +-
> > > drivers/mmc/core/mmc_test.c | 6 +++---
> > > 3 files changed, 5 insertions(+), 5 deletions(-)
> > ...
> > > diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> > > index 096093f7be00..76900f67c782 100644
> > > --- a/drivers/mmc/core/host.c
> > > +++ b/drivers/mmc/core/host.c
> > > @@ -590,7 +590,7 @@ EXPORT_SYMBOL(mmc_alloc_host);
> > >
> > > static void devm_mmc_host_release(struct device *dev, void *res)
> > > {
> > > - mmc_free_host(*(struct mmc_host **)res);
> > > + mmc_free_host(res);
> >
> > The above chunk is wrong and causes following regression on today's
> > Linux next-20230324:
> >
> > Unable to handle kernel paging request at virtual address 0000000000001020
> > Mem abort info:
> > meson-gx-mmc ffe07000.mmc: allocated mmc-pwrseq
> > ...
> > [0000000000001020] user address but active_mm is swapper
> > Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
> > Modules linked in:
> > CPU: 3 PID: 10 Comm: kworker/u12:0 Not tainted 6.3.0-rc3-next-20230324+
> > #13452
> > Hardware name: Khadas VIM3 (DT)
> > Workqueue: events_unbound async_run_entry_fn
> > pstate: 00000005 (nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> > pc : mmc_pwrseq_free+0x1c/0x38
> > lr : devm_mmc_host_release+0x1c/0x34
> > ...
> > Call trace:
> > mmc_pwrseq_free+0x1c/0x38
> > devm_mmc_host_release+0x1c/0x34
> > release_nodes+0x5c/0x90
> > devres_release_all+0x8c/0xdc
> > device_unbind_cleanup+0x18/0x68
> > really_probe+0x11c/0x2b4
> > __driver_probe_device+0x78/0xe0
> > driver_probe_device+0xd8/0x160
> > __device_attach_driver+0xb8/0x138
> > bus_for_each_drv+0x84/0xe0
> > __device_attach_async_helper+0xb0/0xd4
> > async_run_entry_fn+0x34/0xe0
> > process_one_work+0x288/0x5c0
> > worker_thread+0x74/0x450
> > kthread+0x124/0x128
> > ret_from_fork+0x10/0x20
> > Code: f9000bf3 aa0003f3 f9424c00 b4000080 (f9401000)
> > ---[ end trace 0000000000000000 ]---
> >
> > Ulf: do You want me to send a partial revert or will you handle it by
> > dropping this patch?
>
> Thanks for the report, I will simply drop the patch!
>
> Kind regards
> Uffe
> </pre>
>
> sorry for making this mistake, I will check seriously next time.

Np, things go wrong sometimes, even in the simple cases. Feel free to
post an updated patch.

Kind regards
Uffe

2023-03-28 03:20:21

by Yu Zhe

[permalink] [raw]
Subject: [PATCH v2] mmc: core: remove unnecessary (void*) conversions

Pointer variables of void * type do not require type cast.

Signed-off-by: Yu Zhe <[email protected]>
Reviewed-by: Marek Szyprowski <[email protected]>
---
drivers/mmc/core/debugfs.c | 2 +-
drivers/mmc/core/mmc_test.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
index fe6808771bc7..2c97b94aab23 100644
--- a/drivers/mmc/core/debugfs.c
+++ b/drivers/mmc/core/debugfs.c
@@ -246,7 +246,7 @@ DEFINE_DEBUGFS_ATTRIBUTE(mmc_err_state, mmc_err_state_get, NULL, "%llu\n");

static int mmc_err_stats_show(struct seq_file *file, void *data)
{
- struct mmc_host *host = (struct mmc_host *)file->private;
+ struct mmc_host *host = file->private;
const char *desc[MMC_ERR_MAX] = {
[MMC_ERR_CMD_TIMEOUT] = "Command Timeout Occurred",
[MMC_ERR_CMD_CRC] = "Command CRC Errors Occurred",
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index 156d34b2ed4d..0f6a563103fd 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -3045,7 +3045,7 @@ static LIST_HEAD(mmc_test_file_test);

static int mtf_test_show(struct seq_file *sf, void *data)
{
- struct mmc_card *card = (struct mmc_card *)sf->private;
+ struct mmc_card *card = sf->private;
struct mmc_test_general_result *gr;

mutex_lock(&mmc_test_lock);
@@ -3079,8 +3079,8 @@ static int mtf_test_open(struct inode *inode, struct file *file)
static ssize_t mtf_test_write(struct file *file, const char __user *buf,
size_t count, loff_t *pos)
{
- struct seq_file *sf = (struct seq_file *)file->private_data;
- struct mmc_card *card = (struct mmc_card *)sf->private;
+ struct seq_file *sf = file->private_data;
+ struct mmc_card *card = sf->private;
struct mmc_test_card *test;
long testcase;
int ret;
--
2.11.0

2023-04-03 11:27:51

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH v2] mmc: core: remove unnecessary (void*) conversions

On Tue, 28 Mar 2023 at 05:11, Yu Zhe <[email protected]> wrote:
>
> Pointer variables of void * type do not require type cast.
>
> Signed-off-by: Yu Zhe <[email protected]>
> Reviewed-by: Marek Szyprowski <[email protected]>

Did Marek give his reviewed-by tag offlist? I couldn't find his reply,
just to make sure this is correct?

Kind regards
Uffe

> ---
> drivers/mmc/core/debugfs.c | 2 +-
> drivers/mmc/core/mmc_test.c | 6 +++---
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
> index fe6808771bc7..2c97b94aab23 100644
> --- a/drivers/mmc/core/debugfs.c
> +++ b/drivers/mmc/core/debugfs.c
> @@ -246,7 +246,7 @@ DEFINE_DEBUGFS_ATTRIBUTE(mmc_err_state, mmc_err_state_get, NULL, "%llu\n");
>
> static int mmc_err_stats_show(struct seq_file *file, void *data)
> {
> - struct mmc_host *host = (struct mmc_host *)file->private;
> + struct mmc_host *host = file->private;
> const char *desc[MMC_ERR_MAX] = {
> [MMC_ERR_CMD_TIMEOUT] = "Command Timeout Occurred",
> [MMC_ERR_CMD_CRC] = "Command CRC Errors Occurred",
> diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
> index 156d34b2ed4d..0f6a563103fd 100644
> --- a/drivers/mmc/core/mmc_test.c
> +++ b/drivers/mmc/core/mmc_test.c
> @@ -3045,7 +3045,7 @@ static LIST_HEAD(mmc_test_file_test);
>
> static int mtf_test_show(struct seq_file *sf, void *data)
> {
> - struct mmc_card *card = (struct mmc_card *)sf->private;
> + struct mmc_card *card = sf->private;
> struct mmc_test_general_result *gr;
>
> mutex_lock(&mmc_test_lock);
> @@ -3079,8 +3079,8 @@ static int mtf_test_open(struct inode *inode, struct file *file)
> static ssize_t mtf_test_write(struct file *file, const char __user *buf,
> size_t count, loff_t *pos)
> {
> - struct seq_file *sf = (struct seq_file *)file->private_data;
> - struct mmc_card *card = (struct mmc_card *)sf->private;
> + struct seq_file *sf = file->private_data;
> + struct mmc_card *card = sf->private;
> struct mmc_test_card *test;
> long testcase;
> int ret;
> --
> 2.11.0
>

2023-04-03 12:18:45

by Yu Zhe

[permalink] [raw]
Subject: Re: [PATCH v2] mmc: core: remove unnecessary (void*) conversions


> On Tue, 28 Mar 2023 at 05:11, Yu Zhe <[email protected]> wrote:
>> Pointer variables of void * type do not require type cast.
>>
>> Signed-off-by: Yu Zhe <[email protected]>
>> Reviewed-by: Marek Szyprowski <[email protected]>
> Did Marek give his reviewed-by tag offlist? I couldn't find his reply,
> just to make sure this is correct?
>
> Kind regards
> Uffe


Sorry, it may be a misuse of "reviewed-by" tag,  "Marek Szyprowski" gave the error
report at the previous patch, so, i put the name at reviewed-by tag.

>
>> ---
>> drivers/mmc/core/debugfs.c | 2 +-
>> drivers/mmc/core/mmc_test.c | 6 +++---
>> 2 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
>> index fe6808771bc7..2c97b94aab23 100644
>> --- a/drivers/mmc/core/debugfs.c
>> +++ b/drivers/mmc/core/debugfs.c
>> @@ -246,7 +246,7 @@ DEFINE_DEBUGFS_ATTRIBUTE(mmc_err_state, mmc_err_state_get, NULL, "%llu\n");
>>
>> static int mmc_err_stats_show(struct seq_file *file, void *data)
>> {
>> - struct mmc_host *host = (struct mmc_host *)file->private;
>> + struct mmc_host *host = file->private;
>> const char *desc[MMC_ERR_MAX] = {
>> [MMC_ERR_CMD_TIMEOUT] = "Command Timeout Occurred",
>> [MMC_ERR_CMD_CRC] = "Command CRC Errors Occurred",
>> diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
>> index 156d34b2ed4d..0f6a563103fd 100644
>> --- a/drivers/mmc/core/mmc_test.c
>> +++ b/drivers/mmc/core/mmc_test.c
>> @@ -3045,7 +3045,7 @@ static LIST_HEAD(mmc_test_file_test);
>>
>> static int mtf_test_show(struct seq_file *sf, void *data)
>> {
>> - struct mmc_card *card = (struct mmc_card *)sf->private;
>> + struct mmc_card *card = sf->private;
>> struct mmc_test_general_result *gr;
>>
>> mutex_lock(&mmc_test_lock);
>> @@ -3079,8 +3079,8 @@ static int mtf_test_open(struct inode *inode, struct file *file)
>> static ssize_t mtf_test_write(struct file *file, const char __user *buf,
>> size_t count, loff_t *pos)
>> {
>> - struct seq_file *sf = (struct seq_file *)file->private_data;
>> - struct mmc_card *card = (struct mmc_card *)sf->private;
>> + struct seq_file *sf = file->private_data;
>> + struct mmc_card *card = sf->private;
>> struct mmc_test_card *test;
>> long testcase;
>> int ret;
>> --
>> 2.11.0
>>

2023-04-03 12:38:26

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH v2] mmc: core: remove unnecessary (void*) conversions

On Mon, 3 Apr 2023 at 14:13, Yu Zhe <[email protected]> wrote:
>
>
> > On Tue, 28 Mar 2023 at 05:11, Yu Zhe <[email protected]> wrote:
> >> Pointer variables of void * type do not require type cast.
> >>
> >> Signed-off-by: Yu Zhe <[email protected]>
> >> Reviewed-by: Marek Szyprowski <[email protected]>
> > Did Marek give his reviewed-by tag offlist? I couldn't find his reply,
> > just to make sure this is correct?
> >
> > Kind regards
> > Uffe
>
>
> Sorry, it may be a misuse of "reviewed-by" tag, "Marek Szyprowski" gave the error
> report at the previous patch, so, i put the name at reviewed-by tag.

Yes, you shouldn't put his tag like this, unless he explicitly has said so.

For bug reports we use "Reported-by:", but in this case I decided it
was better to drop the offending commit, which means this isn't
applicable here.

Anyway, there is no need to resend, I will just drop the tag when applying.

Kind regards
Uffe

>
> >
> >> ---
> >> drivers/mmc/core/debugfs.c | 2 +-
> >> drivers/mmc/core/mmc_test.c | 6 +++---
> >> 2 files changed, 4 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
> >> index fe6808771bc7..2c97b94aab23 100644
> >> --- a/drivers/mmc/core/debugfs.c
> >> +++ b/drivers/mmc/core/debugfs.c
> >> @@ -246,7 +246,7 @@ DEFINE_DEBUGFS_ATTRIBUTE(mmc_err_state, mmc_err_state_get, NULL, "%llu\n");
> >>
> >> static int mmc_err_stats_show(struct seq_file *file, void *data)
> >> {
> >> - struct mmc_host *host = (struct mmc_host *)file->private;
> >> + struct mmc_host *host = file->private;
> >> const char *desc[MMC_ERR_MAX] = {
> >> [MMC_ERR_CMD_TIMEOUT] = "Command Timeout Occurred",
> >> [MMC_ERR_CMD_CRC] = "Command CRC Errors Occurred",
> >> diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
> >> index 156d34b2ed4d..0f6a563103fd 100644
> >> --- a/drivers/mmc/core/mmc_test.c
> >> +++ b/drivers/mmc/core/mmc_test.c
> >> @@ -3045,7 +3045,7 @@ static LIST_HEAD(mmc_test_file_test);
> >>
> >> static int mtf_test_show(struct seq_file *sf, void *data)
> >> {
> >> - struct mmc_card *card = (struct mmc_card *)sf->private;
> >> + struct mmc_card *card = sf->private;
> >> struct mmc_test_general_result *gr;
> >>
> >> mutex_lock(&mmc_test_lock);
> >> @@ -3079,8 +3079,8 @@ static int mtf_test_open(struct inode *inode, struct file *file)
> >> static ssize_t mtf_test_write(struct file *file, const char __user *buf,
> >> size_t count, loff_t *pos)
> >> {
> >> - struct seq_file *sf = (struct seq_file *)file->private_data;
> >> - struct mmc_card *card = (struct mmc_card *)sf->private;
> >> + struct seq_file *sf = file->private_data;
> >> + struct mmc_card *card = sf->private;
> >> struct mmc_test_card *test;
> >> long testcase;
> >> int ret;
> >> --
> >> 2.11.0
> >>