* [PATCH] misc: cardreader: fix overwritten return value in RTS5260 driver
@ 2025-07-27 23:41 Tian
2025-07-28 4:21 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Tian @ 2025-07-27 23:41 UTC (permalink / raw)
To: gregkh, linux-kernel; +Cc: arnd, Tian
In both rts5260.c and rtsx_pcr.c, a return value is set and then
overwritten by a later function call, which makes the original value
unused. This patch ensures the return value is handled properly
to avoid ignoring possible error conditions.
Signed-off-by: Tian <27392025k@gmail.com>
---
drivers/misc/cardreader/rts5260.c | 2 +-
drivers/misc/cardreader/rtsx_pcr.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/cardreader/rts5260.c b/drivers/misc/cardreader/rts5260.c
index d2d3a6ccb8f7..ed8adaab54a8 100644
--- a/drivers/misc/cardreader/rts5260.c
+++ b/drivers/misc/cardreader/rts5260.c
@@ -269,7 +269,7 @@ static int rts5260_card_power_off(struct rtsx_pcr *pcr, int card)
rts5260_card_before_power_off(pcr);
err = rtsx_pci_write_register(pcr, LDO_VCC_CFG1,
LDO_POW_SDVDD1_MASK, LDO_POW_SDVDD1_OFF);
- err = rtsx_pci_write_register(pcr, LDO_CONFIG2,
+ err |= rtsx_pci_write_register(pcr, LDO_CONFIG2,
DV331812_POWERON, DV331812_POWEROFF);
if (pcr->option.ocp_en)
rtsx_pci_disable_ocp(pcr);
diff --git a/drivers/misc/cardreader/rtsx_pcr.c b/drivers/misc/cardreader/rtsx_pcr.c
index a7b066c48740..9fb22f2cedbd 100644
--- a/drivers/misc/cardreader/rtsx_pcr.c
+++ b/drivers/misc/cardreader/rtsx_pcr.c
@@ -1196,7 +1196,7 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr)
/* Gating real mcu clock */
err = rtsx_pci_write_register(pcr, RTS5261_FW_CFG1,
RTS5261_MCU_CLOCK_GATING, 0);
- err = rtsx_pci_write_register(pcr, RTS5261_REG_FPDCTL,
+ err |= rtsx_pci_write_register(pcr, RTS5261_REG_FPDCTL,
SSC_POWER_DOWN, 0);
} else {
err = rtsx_pci_write_register(pcr, FPDCTL, SSC_POWER_DOWN, 0);
--
2.39.5 (Apple Git-154)
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] misc: cardreader: fix overwritten return value in RTS5260 driver
2025-07-27 23:41 [PATCH] misc: cardreader: fix overwritten return value in RTS5260 driver Tian
@ 2025-07-28 4:21 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2025-07-28 4:21 UTC (permalink / raw)
To: Tian; +Cc: linux-kernel, arnd
On Sun, Jul 27, 2025 at 04:41:34PM -0700, Tian wrote:
> In both rts5260.c and rtsx_pcr.c, a return value is set and then
> overwritten by a later function call, which makes the original value
> unused. This patch ensures the return value is handled properly
> to avoid ignoring possible error conditions.
>
> Signed-off-by: Tian <27392025k@gmail.com>
Please use your ful name as per the kernel documentation.
> ---
> drivers/misc/cardreader/rts5260.c | 2 +-
> drivers/misc/cardreader/rtsx_pcr.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/misc/cardreader/rts5260.c b/drivers/misc/cardreader/rts5260.c
> index d2d3a6ccb8f7..ed8adaab54a8 100644
> --- a/drivers/misc/cardreader/rts5260.c
> +++ b/drivers/misc/cardreader/rts5260.c
> @@ -269,7 +269,7 @@ static int rts5260_card_power_off(struct rtsx_pcr *pcr, int card)
> rts5260_card_before_power_off(pcr);
> err = rtsx_pci_write_register(pcr, LDO_VCC_CFG1,
> LDO_POW_SDVDD1_MASK, LDO_POW_SDVDD1_OFF);
> - err = rtsx_pci_write_register(pcr, LDO_CONFIG2,
> + err |= rtsx_pci_write_register(pcr, LDO_CONFIG2,
> DV331812_POWERON, DV331812_POWEROFF);
How was this tested?
And why do the second write if the first one failed?
> if (pcr->option.ocp_en)
> rtsx_pci_disable_ocp(pcr);
Why do this if the write failed?
> diff --git a/drivers/misc/cardreader/rtsx_pcr.c b/drivers/misc/cardreader/rtsx_pcr.c
> index a7b066c48740..9fb22f2cedbd 100644
> --- a/drivers/misc/cardreader/rtsx_pcr.c
> +++ b/drivers/misc/cardreader/rtsx_pcr.c
> @@ -1196,7 +1196,7 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr)
> /* Gating real mcu clock */
> err = rtsx_pci_write_register(pcr, RTS5261_FW_CFG1,
> RTS5261_MCU_CLOCK_GATING, 0);
> - err = rtsx_pci_write_register(pcr, RTS5261_REG_FPDCTL,
> + err |= rtsx_pci_write_register(pcr, RTS5261_REG_FPDCTL,
> SSC_POWER_DOWN, 0);
Is this even going to ever happen? Same for above, how was this tested?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-07-28 4:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-27 23:41 [PATCH] misc: cardreader: fix overwritten return value in RTS5260 driver Tian
2025-07-28 4:21 ` Greg KH
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.