Linux kernel staging patches
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: singh.supreet14@gmail.com
Cc: Viresh Kumar <vireshk@kernel.org>,
	Rui Miguel Silva <rmfrfs@gmail.com>,
	Alex Elder <elder@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: greybus: spilib: Remove the local unused
Date: Thu, 20 Aug 2026 12:46:46 +0200	[thread overview]
Message-ID: <aobbFqlA31y0ilcM@hovoldconsulting.com> (raw)
In-Reply-To: <20260820103235.12306-1-singh.supreet14@gmail.com>

On Thu, Aug 20, 2026 at 04:02:35PM +0530, singh.supreet14@gmail.com wrote:
> From: Supreet Singh <singh.supreet14@gmail.com>
> 
> The return value of spi_new_device() is only used to check whether
> device creation succeeded. Remove the unnecessary local variable and
> check the return value directly.
> 
> Signed-off-by: Supreet Singh <singh.supreet14@gmail.com>
> ---
>  drivers/staging/greybus/spilib.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/greybus/spilib.c b/drivers/staging/greybus/spilib.c
> index 39d5bf234c61..0e8711fdc429 100644
> --- a/drivers/staging/greybus/spilib.c
> +++ b/drivers/staging/greybus/spilib.c
> @@ -444,7 +444,6 @@ static int gb_spi_setup_device(struct gb_spilib *spi, u8 cs)
>  	struct gb_spi_device_config_request request;
>  	struct gb_spi_device_config_response response;
>  	struct spi_board_info spi_board = { {0} };
> -	struct spi_device *spidev;
>  	int ret;
>  	u8 dev_type;
>  
> @@ -480,8 +479,7 @@ static int gb_spi_setup_device(struct gb_spilib *spi, u8 cs)
>  	spi_board.chip_select	= cs;
>  	spi_board.max_speed_hz	= le32_to_cpu(response.max_speed_hz);
>  
> -	spidev = spi_new_device(ctlr, &spi_board);
> -	if (!spidev)
> +	if (!spi_new_device(ctlr, &spi_board))
>  		return -EINVAL;

No, this change just makes the code harder to read.

Johan

  reply	other threads:[~2026-08-20 10:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-20 10:32 [PATCH] staging: greybus: spilib: Remove the local unused singh.supreet14
2026-08-20 10:46 ` Johan Hovold [this message]
2026-08-20 11:22   ` [PATCH] staging: greybus: spilib: Remove the local unused linux-kernel@vger.kernel.org Supreet Singh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aobbFqlA31y0ilcM@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=elder@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=greybus-dev@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=rmfrfs@gmail.com \
    --cc=singh.supreet14@gmail.com \
    --cc=vireshk@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox