[PATCH] misc: ocxl: link: Remove unnecessary (void*) conversions

2023-11-12 Thread Li zeming
The link pointer does not need to cast the type.

Signed-off-by: Li zeming 
---
 drivers/misc/ocxl/link.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/misc/ocxl/link.c b/drivers/misc/ocxl/link.c
index c06c699c0e7b1..03402203cacdb 100644
--- a/drivers/misc/ocxl/link.c
+++ b/drivers/misc/ocxl/link.c
@@ -188,7 +188,7 @@ static void xsl_fault_handler_bh(struct work_struct 
*fault_work)
 
 static irqreturn_t xsl_fault_handler(int irq, void *data)
 {
-   struct ocxl_link *link = (struct ocxl_link *) data;
+   struct ocxl_link *link = data;
struct spa *spa = link->spa;
u64 dsisr, dar, pe_handle;
struct pe_data *pe_data;
@@ -483,7 +483,7 @@ static void release_xsl(struct kref *ref)
 
 void ocxl_link_release(struct pci_dev *dev, void *link_handle)
 {
-   struct ocxl_link *link = (struct ocxl_link *) link_handle;
+   struct ocxl_link *link = link_handle;
 
mutex_lock(_list_lock);
kref_put(>ref, release_xsl);
@@ -540,7 +540,7 @@ int ocxl_link_add_pe(void *link_handle, int pasid, u32 
pidr, u32 tidr,
void (*xsl_err_cb)(void *data, u64 addr, u64 dsisr),
void *xsl_err_data)
 {
-   struct ocxl_link *link = (struct ocxl_link *) link_handle;
+   struct ocxl_link *link = link_handle;
struct spa *spa = link->spa;
struct ocxl_process_element *pe;
int pe_handle, rc = 0;
@@ -630,7 +630,7 @@ EXPORT_SYMBOL_GPL(ocxl_link_add_pe);
 
 int ocxl_link_update_pe(void *link_handle, int pasid, __u16 tid)
 {
-   struct ocxl_link *link = (struct ocxl_link *) link_handle;
+   struct ocxl_link *link = link_handle;
struct spa *spa = link->spa;
struct ocxl_process_element *pe;
int pe_handle, rc;
@@ -666,7 +666,7 @@ int ocxl_link_update_pe(void *link_handle, int pasid, __u16 
tid)
 
 int ocxl_link_remove_pe(void *link_handle, int pasid)
 {
-   struct ocxl_link *link = (struct ocxl_link *) link_handle;
+   struct ocxl_link *link = link_handle;
struct spa *spa = link->spa;
struct ocxl_process_element *pe;
struct pe_data *pe_data;
@@ -752,7 +752,7 @@ EXPORT_SYMBOL_GPL(ocxl_link_remove_pe);
 
 int ocxl_link_irq_alloc(void *link_handle, int *hw_irq)
 {
-   struct ocxl_link *link = (struct ocxl_link *) link_handle;
+   struct ocxl_link *link = link_handle;
int irq;
 
if (atomic_dec_if_positive(>irq_available) < 0)
@@ -771,7 +771,7 @@ EXPORT_SYMBOL_GPL(ocxl_link_irq_alloc);
 
 void ocxl_link_free_irq(void *link_handle, int hw_irq)
 {
-   struct ocxl_link *link = (struct ocxl_link *) link_handle;
+   struct ocxl_link *link = link_handle;
 
xive_native_free_irq(hw_irq);
atomic_inc(>irq_available);
-- 
2.18.2



[PATCH] misc: ocxl: afu_irq: Remove unnecessary (void*) conversions

2023-11-12 Thread Li zeming
The irq pointer does not need to cast the type.

Signed-off-by: Li zeming 
---
 drivers/misc/ocxl/afu_irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/ocxl/afu_irq.c b/drivers/misc/ocxl/afu_irq.c
index a06920b7e049a..36f7379b8e2de 100644
--- a/drivers/misc/ocxl/afu_irq.c
+++ b/drivers/misc/ocxl/afu_irq.c
@@ -57,7 +57,7 @@ EXPORT_SYMBOL_GPL(ocxl_irq_set_handler);
 
 static irqreturn_t afu_irq_handler(int virq, void *data)
 {
-   struct afu_irq *irq = (struct afu_irq *) data;
+   struct afu_irq *irq = data;
 
trace_ocxl_afu_irq_receive(virq);
 
-- 
2.18.2



[PATCH] misc: ocxl: context: Remove unnecessary (void*) conversions

2023-11-12 Thread Li zeming
The ctx pointer does not need to cast the type.

Signed-off-by: Li zeming 
---
 drivers/misc/ocxl/context.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/ocxl/context.c b/drivers/misc/ocxl/context.c
index 7f83116ae11a6..cded7d1caf328 100644
--- a/drivers/misc/ocxl/context.c
+++ b/drivers/misc/ocxl/context.c
@@ -55,7 +55,7 @@ EXPORT_SYMBOL_GPL(ocxl_context_alloc);
  */
 static void xsl_fault_error(void *data, u64 addr, u64 dsisr)
 {
-   struct ocxl_context *ctx = (struct ocxl_context *) data;
+   struct ocxl_context *ctx = data;
 
mutex_lock(>xsl_error_lock);
ctx->xsl_error.addr = addr;
-- 
2.18.2



[PATCH] boot: simple_alloc: check after increasing memory allocation

2022-12-18 Thread Li zeming
The pointer new adds judgment and should help with program robustness.

Signed-off-by: Li zeming 
---
 arch/powerpc/boot/simple_alloc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/boot/simple_alloc.c b/arch/powerpc/boot/simple_alloc.c
index 267d6524caac..db9aaa5face3 100644
--- a/arch/powerpc/boot/simple_alloc.c
+++ b/arch/powerpc/boot/simple_alloc.c
@@ -112,7 +112,9 @@ static void *simple_realloc(void *ptr, unsigned long size)
return ptr;
 
new = simple_malloc(size);
-   memcpy(new, ptr, p->size);
+   if (new)
+   memcpy(new, ptr, p->size);
+
simple_free(ptr);
return new;
 }
-- 
2.18.2



[PATCH] macintosh/windfarm_pid: Add header file macro definition

2022-07-06 Thread Li zeming
I think the header file could avoid redefinition errors.
 at compile time by adding macro definitions.

Signed-off-by: Li zeming 
---
 drivers/macintosh/windfarm_pid.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/macintosh/windfarm_pid.h b/drivers/macintosh/windfarm_pid.h
index 83f747dbeafc..9882e90a5071 100644
--- a/drivers/macintosh/windfarm_pid.h
+++ b/drivers/macintosh/windfarm_pid.h
@@ -1,4 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef _WINDFARM_PID_H
+#define _WINDFARM_PID_H
+
 /*
  * Windfarm PowerMac thermal control. Generic PID helpers
  *
@@ -82,3 +85,4 @@ struct wf_cpu_pid_state {
 extern void wf_cpu_pid_init(struct wf_cpu_pid_state *st,
struct wf_cpu_pid_param *param);
 extern s32 wf_cpu_pid_run(struct wf_cpu_pid_state *st, s32 power, s32 temp);
+#endif
-- 
2.18.2



[PATCH] macintosh/ams/ams: Add header file macro definition

2022-07-06 Thread Li zeming
Add header file macro definition.

Signed-off-by: Li zeming 
---
 drivers/macintosh/ams/ams.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/macintosh/ams/ams.h b/drivers/macintosh/ams/ams.h
index 935bdd9cd9a6..5ec5547f151b 100644
--- a/drivers/macintosh/ams/ams.h
+++ b/drivers/macintosh/ams/ams.h
@@ -1,4 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _AMS_H
+#define _AMS_H
+
 #include 
 #include 
 #include 
@@ -69,3 +72,4 @@ extern int ams_i2c_init(struct device_node *np);
 
 extern int ams_input_init(void);
 extern void ams_input_exit(void);
+#endif
-- 
2.18.2