linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: Remove the dead code
@ 2022-10-04  5:56 Muhammad Usama Anjum
  2022-10-04 11:09 ` Muhammad Usama Anjum
  0 siblings, 1 reply; 2+ messages in thread
From: Muhammad Usama Anjum @ 2022-10-04  5:56 UTC (permalink / raw)
  To: Mark Brown
  Cc: Muhammad Usama Anjum, kernel, kernel-janitors, linux-spi, linux-kernel

The vmallocated_buf is being checked if it is true inside the body of a
if condition which has already checked if it is true. Remove the
duplication and dead code as a result.

Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
 drivers/spi/spi.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 44e4352d948b..4c51cd4e4ab0 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1057,10 +1057,7 @@ static int spi_map_buf_attrs(struct spi_controller *ctlr, struct device *dev,
 			min = min_t(size_t, desc_len,
 				    min_t(size_t, len,
 					  PAGE_SIZE - offset_in_page(buf)));
-			if (vmalloced_buf)
-				vm_page = vmalloc_to_page(buf);
-			else
-				vm_page = kmap_to_page(buf);
+			vm_page = vmalloc_to_page(buf);
 			if (!vm_page) {
 				sg_free_table(sgt);
 				return -ENOMEM;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] spi: Remove the dead code
  2022-10-04  5:56 [PATCH] spi: Remove the dead code Muhammad Usama Anjum
@ 2022-10-04 11:09 ` Muhammad Usama Anjum
  0 siblings, 0 replies; 2+ messages in thread
From: Muhammad Usama Anjum @ 2022-10-04 11:09 UTC (permalink / raw)
  To: Mark Brown; +Cc: usama.anjum, kernel, kernel-janitors, linux-spi, linux-kernel

Please disregard this patch. This is wrong and not needed.

On 10/4/22 10:56 AM, Muhammad Usama Anjum wrote:
> The vmallocated_buf is being checked if it is true inside the body of a
> if condition which has already checked if it is true. Remove the
> duplication and dead code as a result.
> 
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
>  drivers/spi/spi.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 44e4352d948b..4c51cd4e4ab0 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -1057,10 +1057,7 @@ static int spi_map_buf_attrs(struct spi_controller *ctlr, struct device *dev,
>  			min = min_t(size_t, desc_len,
>  				    min_t(size_t, len,
>  					  PAGE_SIZE - offset_in_page(buf)));
> -			if (vmalloced_buf)
> -				vm_page = vmalloc_to_page(buf);
> -			else
> -				vm_page = kmap_to_page(buf);
> +			vm_page = vmalloc_to_page(buf);
>  			if (!vm_page) {
>  				sg_free_table(sgt);
>  				return -ENOMEM;

-- 
Muhammad Usama Anjum

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-04 11:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-04  5:56 [PATCH] spi: Remove the dead code Muhammad Usama Anjum
2022-10-04 11:09 ` Muhammad Usama Anjum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).