public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* re: ACPI / video: Run _BCL before deciding registering backlight
@ 2015-06-20 12:26 Dan Carpenter
  2015-06-20 12:34 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-06-20 12:26 UTC (permalink / raw)
  To: aaron.lu; +Cc: linux-acpi

Hello Aaron Lu,

The patch dce4ec2e452f: "ACPI / video: Run _BCL before deciding
registering backlight" from Oct 28, 2014, leads to the following
static checker warning:

	drivers/acpi/acpi_video.c:1659 acpi_video_run_bcl_for_osi()
	warn: calling kfree() when 'levels' is always NULL.

drivers/acpi/acpi_video.c
  1651  static void acpi_video_run_bcl_for_osi(struct acpi_video_bus *video)
  1652  {
  1653          struct acpi_video_device *dev;
  1654          union acpi_object *levels;
  1655  
  1656          mutex_lock(&video->device_list_lock);
  1657          list_for_each_entry(dev, &video->video_device_list, entry) {
  1658                  if (!acpi_video_device_lcd_query_levels(dev, &levels))
  1659                          kfree(levels);

kfree(NULL) is a no-op.  We could just remove the if statement here.

		list_for_each_entry(dev, &video->video_device_list, entry) {
			acpi_video_device_lcd_query_levels(dev, &levels);
		}

But then it's not clear to me the point of this loop is?

  1660          }
  1661          mutex_unlock(&video->device_list_lock);
  1662  }

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in

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

* Re: ACPI / video: Run _BCL before deciding registering backlight
  2015-06-20 12:26 ACPI / video: Run _BCL before deciding registering backlight Dan Carpenter
@ 2015-06-20 12:34 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2015-06-20 12:34 UTC (permalink / raw)
  To: aaron.lu; +Cc: linux-acpi

This static checker warning was totally wrong.  Sorry for the noise.

regards,
dan carpente

On Sat, Jun 20, 2015 at 03:26:39PM +0300, Dan Carpenter wrote:
> Hello Aaron Lu,
> 
> The patch dce4ec2e452f: "ACPI / video: Run _BCL before deciding
> registering backlight" from Oct 28, 2014, leads to the following
> static checker warning:
> 
> 	drivers/acpi/acpi_video.c:1659 acpi_video_run_bcl_for_osi()
> 	warn: calling kfree() when 'levels' is always NULL.
> 
> drivers/acpi/acpi_video.c
>   1651  static void acpi_video_run_bcl_for_osi(struct acpi_video_bus *video)
>   1652  {
>   1653          struct acpi_video_device *dev;
>   1654          union acpi_object *levels;
>   1655  
>   1656          mutex_lock(&video->device_list_lock);
>   1657          list_for_each_entry(dev, &video->video_device_list, entry) {
>   1658                  if (!acpi_video_device_lcd_query_levels(dev, &levels))
>   1659                          kfree(levels);
> 
> kfree(NULL) is a no-op.  We could just remove the if statement here.
> 
> 		list_for_each_entry(dev, &video->video_device_list, entry) {
> 			acpi_video_device_lcd_query_levels(dev, &levels);
> 		}
> 
> But then it's not clear to me the point of this loop is?
> 
>   1660          }
>   1661          mutex_unlock(&video->device_list_lock);
>   1662  }
> 
> regards,
> dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in

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

end of thread, other threads:[~2015-06-20 12:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-20 12:26 ACPI / video: Run _BCL before deciding registering backlight Dan Carpenter
2015-06-20 12:34 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox